Nginx with http/https - Http seemed redirected to https all the time

Posted by dwarfy on Server Fault See other posts from Server Fault or by dwarfy
Published on 2012-09-19T21:23:21Z Indexed on 2012/09/19 21:39 UTC
Read the original article Hit count: 375

Filed under:
|
|
|
|

I've this really weird behaviour with my ubuntu 10.04 / nginx 1.2.3 server. Basically I changed the SSL certificates this morning. And ever since it has been behaving weirdly on all apps. Godaddy is reporting that HTTPS/SSL setup is correct.

When I try a page it still works correctly when I'm using HTTPS. But when I try using HTTP nginx reports error :

400 Bad Request
The plain HTTP request was sent to HTTPS port

After looking around on google for hours, I've tried different setup (while originaly my setup was working correctly for longtime, I just renewed certificates)

I kindof found a half solution by adding this to my config :

error_page 497 $request_uri;

The realllly weird thing is that when I use this setup :

server {
    listen 80;
    server_name john.johnrocks.eu;

    access_log /home/john/envs/john_prod/nginx_access.log;
    error_log /home/john/envs/john_prod/nginx_error.log;

    location / {
        uwsgi_pass unix:///home/john/envs/john_prod/john.sock;
        include uwsgi_params;
    }

    location  /media  {
        alias   /home/john/envs/john_prod/johntab/www;
    }

    location  /adminmedia  {
        alias   /home/john/envs/john_prod/johntab/www/adminmedia;
    }
}

I still have the same error when using HTTP (while nothing is setup for HTTPS here)??

I'm getting crazy on this !

© Server Fault or respective owner

Related posts about nginx

Related posts about ssl