I am having a problem with nginx "location" directive and regular expressions.

I want to have a location match a url that begins with "/user-profile".

The problem is that nginx does not match that, however if I change the config and try with userprofile (i.e. no hyphen) it works like a charm.

I think that there is regexp related problem, but can't get my head around it.

My current config is:

location ^~ /user-profile {
    proxy_pass http://remotesites;
}

And I've also tried with:

location ^~ /user\-profile {
    proxy_pass http://remotesites;
}

I appreciate any help you can give me.

Thanks!

Edit
Report