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

godaddyhttpsnginxssluwsgi

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 !

**Update

Even with this config :

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

    access_log  /home/john/envs/john_prod/nginx.access.log;

    location / {
        root   /home/john/envs/john_prod/johntab/www;
        index  index.html index.htm;
    }
}

I get error 400 (The plain HTTP request was sent to HTTPS port) on everything I try to load ..

Best Answer

I don't know about the 400 error, but if you had an 301 (permanent) redirect in your previous config, the browser might still have stored this redirect in the cache and doesn't check the original. Maybe purging your caches might help.