Welcome! Log In Create A New Profile

Advanced

Re: Disable Port removing on rewrite

September 16, 2016 02:06PM
16. September 2016 19:34, "Francis Daly" <francis@daoine.org> schrieb:
> * Since you already rewrite all requests that do not end in /; if you can
> confirm that your clients send the name:port in the Host header that
> they send, then you could change the rewrite destination to explicitly
> include that:
>
> rewrite ^(.*[^/])$ http://$http_host$1/ permanent;
>
> This would break any clients that do not send the Host: header that you
> expect -- possibly that matters; possibly it doesn't. It is not clear
> to me how your current config can work -- with the rewrite, no request
> will match your ".php$" location. If that is to change, and you have an
> enumerable list of "directories" where you want the add-a-slash redirect,
> you could create a bunch of explicit "location =" blocks that do "return
> 301" with $http_host.

Thanks alot!
I used your rewrite tipp!
I modified the rule and added a if statement:
if (-d $request_filename) {
rewrite [^/]$ $scheme://$http_host$uri/ permanent;
}

I think nowdays almost every browser sends the HTTP header (i hope so)


thanks again!
----------
Niklas

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Disable Port removing on rewrite

Gurken2108 September 16, 2016 10:40AM

Re: Disable Port removing on rewrite

Francis Daly September 16, 2016 01:36PM

Re: Disable Port removing on rewrite

Gurken2108 September 16, 2016 02:06PM

Re: Disable Port removing on rewrite

Francis Daly September 16, 2016 03:02PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 205
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready