Remove trailing slash from nginx on HTTP -> HTTPS redirect -
Remove trailing slash from nginx on HTTP -> HTTPS redirect -
i'm trying figure out why config below redirects, e.g. example.com https://example.com// (notice double trailing slash). i've tried using rewrite instead of homecoming 301 , still same issue. in advanced
my config:
server { hear 80; homecoming 301 https://$host/$request_uri; } server { hear 443 default_server ssl; server_name example.com; ssl_certificate /etc/nginx/ssl/ssl.crt; ssl_certificate_key /etc/nginx/ssl/ssl.key; ssl_session_timeout 5m; ssl_protocols sslv3 tlsv1; ssl_ciphers all:!adh:!export56:rc4+rsa:+high:+medium:+low:+sslv3:+exp; ssl_prefer_server_ciphers on; location / { proxy_pass_header server; proxy_set_header host $http_host; proxy_redirect off; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-scheme $scheme; proxy_connect_timeout 10; proxy_read_timeout 10; proxy_pass http://192.168.1.2:8000; } }
i think $request_uri
contains slash (i.e., it's '/' index page) might alter this:
return 301 https://$host/$request_uri;
to this:
return 301 https://$host$request_uri;
nginx
Comments
Post a Comment