Welcome! Log In Create A New Profile

Advanced

Rewrite with number after hyphen

Ivan Bianchi
September 03, 2018 02:14AM
Hi,

I detected an issue with my rewrite rule in the nginx.conf and I don't
understand why it happens and how to fix it.

I have tested in two environments with versions 1.10.3 and 1.14.0.

Having the following simple conf with a regex is intended to get everything:

> location /foo {
> rewrite /foo/(.*) /web/foo.do?a=$1 last;
> }


OK:

> https://www.test.com/foo/asdf

https://www.test.com/foo/asdf-asdf

https://www.test.com/foo/asdf12

https://www.test.com/foo/asdf12-asdf

https://www.test.com/foo/12

https://www.test.com/foo/-12


KO:

> https://www.test.com/foo/asdf-12

https://www.test.com/foo/asdf-12-asdf


As implementing pcre regex, this regex works in all cases in the common
regex online sites but not in nginx.

Why if I put a number after a hyphen the regex stops working?

Many thanks,

--
Ivan Bianchi
Wikiloc
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Rewrite with number after hyphen

Ivan Bianchi September 03, 2018 02:14AM

Re: Rewrite with number after hyphen

Francis Daly September 03, 2018 08:38AM

Re: Rewrite with number after hyphen

Ivan Bianchi September 05, 2018 10:26AM

RE: [IE] Re: Rewrite with number after hyphen

jasonw September 05, 2018 02:32PM

Re: [IE] Re: Rewrite with number after hyphen

Ivan Bianchi September 06, 2018 02:38AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 206
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