redirect https:// to https://www produce untrusted connection

pablo platt pablo.platt at gmail.com
Mon May 10 00:35:23 MSD 2010


Hi,

I'm running a website with nginx as a proxy and for static files.
I'm using the ubuntu lucid nginx package - version 0.7.65
http://example.com redirect to http://www.example.com - works
https://www.example.com - SSL works
https://example.com redirect to https://www.example.com - doesn't work and
show untrusted connection in the browser.

I have two questions:
- Why SSL only works when I use default on the listen: "listen     443
default;"
- Why I can't redirect https:// to https://www before I'm getting the
untrusted connection warning.

Thanks

My config file:
server {
    listen   80;
    server_name  example.com.com;
    rewrite ^/(.*) http://www.example.com/$1 permanent;
}

server {
    listen       80;
    server_name  www.example.com;

    location / {
        proxy_pass http://127.0.0.1:8000;
    }

    ...
}

server {
    listen   443;
    server_name  example.com.com;
    rewrite ^/(.*) https://www.example.com.com/$1 permanent;
}

server {
    listen     443 default;

    ssl    on;
    ssl_certificate    /etc/nginx/ssl/example.pem;
    ssl_certificate_key    /etc/nginx/ssl/example.key;

    server_name  www.example.com;

    location / {
        proxy_pass http://127.0.0.1:8000;
    }
    ...
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20100509/ef44f9fa/attachment.html>


More information about the nginx mailing list