(https)Nginx --> (http)Play!. But request.secure is false

Viewed 3819

Configured Nginx as reverse proxy in front of Play! and passing https with the following headers set :-

        proxy_set_header   X-Forwarded-Proto https; 
        proxy_set_header   X-Forwarded-Ssl https; 

login() [https://localhost/login] is being forwarded to Play! on port 9000 as 'http'. But request.secure in login() is still 'false'. Any idea ?

UPDATE: here is the server conf:-

server {
    listen                443;
    server_name           localhost;

    ssl                   on;
    ssl_certificate       /home/aymer/play/key/localhost.crt;
    ssl_certificate_key   /home/aymer/play/key/localhost.key;
    ssl_session_timeout   5m;

    location ~ ^/(images|javascript|js|css|flash|media|static)/  {
            root    /home/aymer/play/playapp/public;
            expires 30d;
    }

    location ~* (login|register)$ { 
            proxy_pass         http://localhost:9000;
            proxy_redirect     off;

            proxy_set_header   Host               $host;
            proxy_set_header   X-Real-IP          $remote_addr;
            proxy_set_header   X-Forwarded-Proto  https;
            proxy_set_header   X-Forwarded-Ssl    on;
        }

    location / {
        rewrite ^/(.*) http://$host/$1 permanent;
    }
}
3 Answers
Related