Nginx reverse proxy regex help

Francis Daly francis at
Sat Sep 18 07:48:50 UTC 2021

On Fri, Sep 17, 2021 at 01:34:32AM -0400, blason wrote:

Hi there,

> I have server whose URL is https://xx.xx.xx.xx/TestPage/ which gets
> generated as

You have a variety of .xx and .ss, and it's not immediately clear to me
which sets are the same and which sets are not.

If you use something like "" and "", or
"IP1" and "IP2", then if the problem is that you are using and unexpected
address, that might become obvious. Thanks.

I'm also not quite clear on what you mean by "which gets generated as".

Do you mean that if you make a request for
https://backend-server/TestPage/ it returns a http redirect to
and you are then expected to make a new request for

Or it is something else?

> Now I have implemented nginx reverse proxy in front this server and then I
> have done the config proxy_pass as 
> proxy_pass;
> Now if you see after TestPage there is a unique value gets added and then
> index.aspx however whenever request is passed through nginx I get 502
> badgateway.

What does the nginx error log say about the 502 response?

> Wondering how do I pass that unique value through regex? 

You should not need to do anything special, as you are using a
"prefix-match" location.

Because you are doing "proxy_pass https://", you may want to check what
the backend-server responds with when you make this request from the
nginx server -- if it is serving more than one site on the same ip:port,
you will want to be sure that it is using the site that you want it to
be using.


Francis Daly        francis at

More information about the nginx mailing list