New on LowEndTalk? Please Register and read our Community Rules.
Nginx 400 Bad Request The plain HTTP request was sent to HTTPS port
Updated to nginx 1.8 today, everything works fine except when I go to naked domain with http, I got 400 bad request error.
I redirect all naked domain to www, and all http to https. Only getting the error with http naked domain. http with www works just fine.
cloudflare would not let me copy/paste my nginx config file in text here .... lol
Comments
Try getting rid of "ssl on;"
From http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl:
Tried, still seeing error
Well in that case just separate the SSL and non-SSL into separate vhosts.
Based on http://serverfault.com/questions/583136/nginx-issues-between-vhosts-and-ssl it sounds like having them in same vhost isn't supported anymore.
Edit: actually nvm, I read that wrong, it should work without the "ssl on" directive; not sure then.
oh well, I removed "ssl on;" on all vhosts and problem solved. thanks @perennate
On a side note, you could use an include statement to keep from repeating all of the SSL config in both server blocks.