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

Igor Sysoev is at rambler-co.ru
Wed Nov 14 15:03:34 MSK 2007


On Wed, Nov 14, 2007 at 12:54:20PM +0100, Alain Spineux wrote:

> Hi
> 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

Try

-             proxy_redirect        default;
+             proxy_redirect        http://eg01.emailgency.loc/  /;


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list