proxy_redirect not working with https, redirect to http instead of https

Alain Spineux aspineux at gmail.com
Wed Nov 14 14:54:20 MSK 2007


Hi

I have a turbogears application running on http://localhost:8080/eg/
I use nginx to provide an HTTPS access.
Everything works except when my apps make redirection, the url is well rewritten
but the http is not rewrittent into https, ginving
http://eg01.emailgency.loc/eg/addr/
instead of
https://eg01.emailgency.loc/eg/addr/

I installed nginx 6.16 to test last "mail" features,
but expect to downgrade to stable version.

    server {
        listen               443;
        server_name     eg01.emailgency.loc;
        ssl                  on;
        ssl_certificate      /kolab/etc/kolab/cert.pem;
        ssl_certificate_key  /kolab/etc/kolab/key.pem;

        location /eg/ {
            proxy_pass            http://localhost:8080/eg/;
            proxy_redirect        default;
            #proxy_redirect        http://localhost:8080/eg/
https://eg01.emailgency.loc/eg/; # don't work !
            proxy_set_header      Host $host;
            proxy_set_header      X-Real-IP $remote_addr;
        }

    }

If I add this

    server {
        listen               80;
        rewrite ^(.*)        https://eg01.emailgency.loc$1 redirect;
    }

then its works but with one more redirection

Any idea ?

Regards.

-- 
Alain Spineux
aspineux gmail com
May the sources be with you





More information about the nginx mailing list