Problems with NGINX URL Path Prefix

Started by Layer8, July 06, 2023, 10:31:36 AM

Previous topic - Next topic
July 06, 2023, 10:31:36 AM Last Edit: July 06, 2023, 11:32:54 AM by Layer8
Hi,

we would like to build a setup, where we have our public domain like https://our.domain.com/remoteservice-1/  (1 is a ID of a customer) which leads to our internal upstream servers like https://10.10.1.2-255/guacamole

https://our.domain.com/remotservice-2/ is the public URL for the second customer and so on, which lead to the internal upstream servers like https://10.10.2.2-254/guacamole


In a native NGINX setup, this can be done with

Quote
location /remoteservice-1/
        {
      proxy_pass         https://10.10.1.2/guacamole;
      proxy_redirect     default;
   }


Everything is working fine when we define our location with URL Pattern = "/" and URL Path Prefix  = none. In this case, we can open https://our.domain.com/guacamole and access the upstream.

We figured out, that a Upstream + URL Path prefix in the OPNsense location section is the same like
"proxy_pass         https://10.10.1.2/guacamole;" in a nginx config file.


So, we changed our location in the OPNsense to:
URL Pattern = /remoteservice-1/
and
URL Path prefix = /guacamole


But its not working.

When we open https://our.domain/remoteservice-1/ , we get the following error message in the browser:


QuoteNot Found

The resource you want to access is not available.

Please contact the webmaster if you think this is an error.

Web Application Protection by OPNsense



Is this a bug? How can we solve this issue?





July 06, 2023, 10:40:54 AM #1 Last Edit: July 06, 2023, 11:21:04 AM by Layer8
We also downloaded the nginx config file from /usr/local/etc/nginx/nginx.conf and checked the proxy_pass value, which is like:

Quoteproxy_pass http://upstream7108f66f5b00442eaa4e2188a4d41008/guacamole;




We found the reason for this behavior.

The green one is working fine, the red one not. The missing "/" was the problem.