http to https rewrite, non-standard port?

cyberjar09 nginx-forum at nginx.us
Mon Jan 7 09:16:54 UTC 2013


I tried the above but Cant seem to get it working : please see below

......
        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;

        server {
           listen                       9000;
           server_name                  iossapp1.com;

           if ($scheme = 'http') {
                rewrite ^              
https://$server_name:9443$request_uri? permanent;
           }
        }

        ssl_certificate                 /etc/nginx/ssl/server.crt;
        ssl_certificate_key             /etc/nginx/ssl/server.key;

        server {
           listen                            9443 ssl;
           server_name                  iossapp1.com;

          error_page   497             https://$host:9443$request_uri;

           location / {
                proxy_pass              http://127.0.0.1:9001;
                proxy_set_header        Host            $host;
#               proxy_set_header        X-Forwarded-Ssl on;
                proxy_set_header        X-Real-IP       $remote_addr;
                proxy_set_header        X-Forwarded-For
$proxy_add_x_forwarded_for;
           }
        }
}


Any help would be much appreciated

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,155978,234760#msg-234760



More information about the nginx mailing list