OPNsense Forum

English Forums => Web Proxy Filtering and Caching => Topic started by: mm23282236 on November 28, 2022, 01:18:49 am

Title: [SOLVED] Nginx and Omada controller (Solved for now)
Post by: mm23282236 on November 28, 2022, 01:18:49 am
I'm trying to get Nginx to reverse proxy the Omada controller.

Basically when you set it up in the Nginx GUI and try to accees the Omada host you are greeted with a blank page, a 404 page, or a time out.

After much troubleshooting I finally narrowed it down to a couple of lines in the nginx.conf file.

- "proxy_set_header Host $host;"
- "proxy_pass https://upstream<UUID>;"

If I comment out the host header and set proxy_pass to the actual host of the machine Omada is hosted at, it works flawlessly. The downside to all of this, as soon as you make any changes in the gui the config is wiped out and we are back to square 1.

So a few questions:

- Is there a way to create a custom configuration for this one host and still be able to use the GUI for other settings?

- Is there away to disable the host header and/or use proxy_pass with a single server instead of trying to load balance with upstream?

- Is there something im overlooking?
Title: Re: nginx and Omada controller
Post by: Fright on November 29, 2022, 01:24:05 pm
Quote
Is there a way to create a custom configuration for this one host and still be able to use the GUI for other settings?
yes.
at the end of each server block there is a hook like
Code: [Select]
    include 728012f5-11ee-4fe3-ac61-7d8fb92420ad_post/*.conf;

}
server {
so you can create uuid_post dir at /usr/local/etc/nginx and place a .conf file with additional settings in this folder. in this case it will be full locations blocks for Omada

Quote
Is there away to disable the host header?
afaik host header can not be disabled. it may not be present in the configuration. but then nginx will set the "$proxy_host" value for it. which in combination with the use of "upstreams" in proxy_pass will give an undesirable result.

Quote
and/or use proxy_pass with a single server instead of trying to load balance with upstream?
not via gui.
Title: Re: nginx and Omada controller
Post by: mm23282236 on November 30, 2022, 02:49:07 pm
Awesome, that worked! Thanks Fright.

For those coming here looking for answers here are the steps that I took. I created a location to be used as a "template" then deleted it afterwards, you'll see this in the steps below. This will require dealing with command line stuff, so if you are not comfortable with that, don't do this. Also, this assumes you already have somewhat of a grasp dealing with Nginx configs. I am not great at explaining things, so if others have a better and/or prettier way to do this, please feel free to do so.


If everything went well, you should now be able to access the Omada interface through your proxy.

I'm unsure if this setup will survive an update, I'm guessing it wont, so make note of what you did to get it to work so that when you update its a somewhat quick process. Hopefully in the future there will be some more options in the GUI to better customize Nginx for services that don't like to play nice.....Omada!....

Thanks and I hope this helps. Good luck!
Title: Re: [SOLVED] Nginx and Omada controller (Solved for now)
Post by: Fright on November 30, 2022, 03:07:28 pm
glad it works  ;)
Quote
I'm unsure if this setup will survive an update, I'm guessing it wont
will survive
Title: Re: [SOLVED] Nginx and Omada controller (Solved for now)
Post by: tozim on December 21, 2022, 02:55:02 pm
Just to be clear, this completely bypasses the upstream config done in the OPNsense GUI, right?
Title: Re: [SOLVED] Nginx and Omada controller (Solved for now)
Post by: Fright on December 21, 2022, 04:02:18 pm
if nessesary. technically in this file you can refer to upstreams configured in the gui