Welcome! Log In Create A New Profile

Advanced

Re: Cannot strip QS in rewrite

Maxim Dounin
June 20, 2019 11:22AM
Hello!

On Thu, Jun 20, 2019 at 05:05:57PM +0200, aquilinux wrote:

> Hi guys, i've always used ? to strip QS in rewrites but i cannot get past
> this odd issue i'm having:
>
> URL SOURCE:
>
> > https://www.example.co.uk/ambassadors?test=1
>
>
> REWRITE:
>
> > rewrite (?i)^/ambassadors$
> > https://www.example.com/uk-en/experience/ambassadors/? permanent;
>
>
> OR EVEN:
>
> > location ~* ^/ambassadors$ {
> > rewrite (.*) https://www.example.com/uk-en/experience/ambassadors/?
> > permanent;
> > }
>
>
> RESULT WITH REWRITE:
>
> > [~]> curl -kIL https://www.example.co.uk/ambassadors?test=1
> > HTTP/2 301
> > date: Thu, 20 Jun 2019 14:44:21 GMT
> > content-type: text/html
> > location: https://www.example.com/uk-en/experience/ambassadors/?test=1
> > x-who: SVAORMG2V01

An nginx response is expected to contain "server:
nginx/<version>", for example:

$ curl -kI https://127.0.0.1:8443/ambassadors?test=1
HTTP/2 301
server: nginx/1.17.1
date: Thu, 20 Jun 2019 15:11:51 GMT
content-type: text/html
content-length: 169
location: https://www.example.com/uk-en/experience/ambassadors/

Are you sure the response you've provided is from nginx?

(Also, as you can see from the above example response, the rewrite
is working fine.)

You may also want to drop "-L" from your curl options to make sure
you are looking at a particular response, and not a chain of
redirects.

If the above doesn't help, you may consider using "rewrite_log on;"
to find out how your rewrites are processed (see
http://nginx.org/r/rewrite_log for details).

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Cannot strip QS in rewrite

aquilinux June 20, 2019 11:08AM

Re: Cannot strip QS in rewrite

Maxim Dounin June 20, 2019 11:22AM

Re: Cannot strip QS in rewrite

aquilinux June 21, 2019 06:52AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 319
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready