Skip to main content Running Unifi controller behind a reverse proxy. : r/selfhosted

Running Unifi controller behind a reverse proxy.

Proxy

I am trying to setup the Unifi controller behind a reverse proxy using nginx-proxy-manager it more or less appears to work but I keep getting 400 errors.

r/selfhosted - Running Unifi controller behind a reverse proxy.

If I try to use the software internally (192.168.1.246:8443) it all works as expected.

I found a similar issue in the Caddy forums which sounds like exactly the same problem, it suggest adding the adding the following to the proxy command (proxy command being a Caddy thing I assume):

header_upstream -Authorization

Based on the issue I believe what this is doing is removing the Authorization header from the proxied requests? If this is right how would I go about doing this with nginx? (I am very very new to reverse proxies and server stuff in general).

nginx-proxy-manager gives the following interface to add custom rules to proxy hosts (not sure if this helps):

r/selfhosted - Running Unifi controller behind a reverse proxy.

If there is a better place to post this please let me know, I couldn't think of where to post it.res

**UPDATE**

Enabling websockets resolved the issue.

Securely manage Windows devices without the headaches. (Really.) Stand up Intune pain-free along with Zip’s all-in-one security, IT, & compliance platform.
Sort by:
Best
Open comment sort options

I've never used nginx-proxy-manager, but this is my (working) nginx setup for unifi:

location / {
proxy_pass https://127.0.0.1:8443;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_http_version 1.1;
proxy_set_header Connection "upgrade";
}

Awesome I will have a play around with this tonight, I am not quite sure how nginx-proxy-manager works internally so I am just going to try pasting that in and then start messing with it :).

Cheers!

More replies
More replies

In nginx-proxy-manager do you have the scheme set to https? It defaults to http but needs to be on https as the unifi controller is configured to only accept connections over https.

(I just tested on my config and changing to http causes it to throw 400 errors)

I've been running Unifi controller for several months behind nginx-proxy-manager for with Scheme set to https, Websockets Support enabled, and Block Common Exploits enabled.

I do have it set to https:// I have not enabled Websockets, or Blocked common exploits though, I will try that tonight!

Cheers!

More replies
[deleted]

Comment deleted by user

nginx-proxy-manager runs in docker by default.

I tried setting up Traefik on Unraid for weeks to no avail, not to mention I encountered all manner of issues, furthermore resources on Traefik (excluding it's documentation are scarce at best) using ngix-proxy-manager at least I am essentially using nginx.

Additionally what would be the point in moving my whole setup over to Traefik just so I could run the Unifi controller like that when everything else is working with nginx-proxy-manager?

I like the idea of Traefik, but after a lot of trial an error trying to set it up I was able to get up and running with nginx-proxy-manager very fast, with the added bonus of it having a nice GUI and simply user access management which has been great.

More replies

With Caddy it's really easy. Search for Caddy+Unifi

Why not connect it to https://unifi.ubnt.com/ ?

What's the point of self hosting if you're depending on someone else's servers?

Doesn't work on Safari.

More replies