NGINX: Can I use URL Pattern Matching to reverse proxy to different servers?

Started by always_learning, January 16, 2021, 08:58:30 PM

Previous topic - Next topic
Quote from: Fright on January 23, 2021, 06:21:34 AM
hm. sorry, but did you "apply" after making changes? )
inside the server configuration block, after the directives for the logs and error pages paths, the locations configuration blocks should begin: first built-in, and then added by you through the GUI

Yes.  I did make sure to apply the settings by clicking the "apply" button on the General Settings tab of the configuration page.  I haven't tried restarting or anything, but when I log out and log back in and then navigate to the nginx plugin settings, the custom location configuration is persistent.

sorry, realy dont know what to say. other nginx.conf file is a template file at /usr/local/opnsense/service/templates/opnsense/nginx/ but its small and contains only modules and includes

real nginx config should be in /usr/local/etc/nginx/nginx.conf

Quote from: Fright on January 25, 2021, 07:25:05 AM
sorry, realy dont know what to say. other nginx.conf file is a template file at /usr/local/opnsense/service/templates/opnsense/nginx/ but its small and contains only modules and includes

real nginx config should be in /usr/local/etc/nginx/nginx.conf

I have decided to come back to this to try and figure out a little more.  In the nginx.conf file located in the directory you indicated, it seems that all the locations are generic but are linked to upstream servers that are identified by a generated ID, as shown in the image.  I can't change the proxy_pass variable, because it points to the upstream ID.  Take a look at the two images I have attached to see what I'm talking about.

Thanks!

hi
yes. nginx conf looks like it should. you do not need (and you should not, since the file is generated every time you apply the settings) to make changes in the file itself. can make it in GUI.
when you set "/" in "Path prefix field" (look at attached image at https://forum.opnsense.org/index.php?topic=20943.msg98074#msg98074) plugin will generate this directive for you. and you will see that a trailing slash has appeared in the proxy_pass directive