Rewrite with number after hyphen

Francis Daly francis at
Mon Sep 3 12:36:30 UTC 2018

On Mon, Sep 03, 2018 at 08:13:11AM +0200, Ivan Bianchi wrote:

Hi there,

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

This seems to work as expected for me, using nginx/1.14.0.

> KO:
> >

Why do you think it does not work? What is the input/output/expected

For example, if you add the new location

   location = /web/ {
      return 200 "$uri$is_args$args\n";

and repeat the tests, do you see any difference in output?

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

My guesses are:

* you have another location{} that you have configured to match those
requests, so your shown location{} is not involved


* your /web/ location-handler handles those requests differently.

Good luck with it,

Francis Daly        francis at

More information about the nginx mailing list