1

I want to make my Unifi Controller to be accessible through the web, however, no matter what I do (even if Traefik successfully loaded the configuration), it will always give me "Bad Gateway".

Logs telling me that uplink cannot be established (I guess this is due to the fact, that i have to proxy https://0.0.0.0:8443 instead of usual http://)

Controller is installed on my web server, not in Docker, and all ports are allowed for internal network with UFW.

I've created a separate file with configuration, which looks like this:

[backends]
    [backends.unifi]
        [backends.unifi.servers]
            [backends.unifi.servers.server0]
                url = "https://127.0.0.1:8443/"
                weight = 1
[frontends]
    [frontends.unifi]
        entryPoints = ["https", "http"]
        backend = "unifi"
        passHostHeader = true

        [frontends.unifi.routes]
            [frontends.unifi.routes.route0]
                rule = "Host:controller.website.example"

        [frontends.unifi.headers]
            SSLRedirect = true
            STSSeconds = 315360000
            browserXSSFilter = true
            contentTypeNosniff = true
            forceSTSHeader = true
            SSLHost = "website.example"
            STSIncludeSubdomains = true
            STSPreload = true
            frameDeny = true

It is stored in a separate file in the directory inside the traefik "rules" folder, which is loaded by this config inside the traefik.toml

[file]
  directory = "/etc/traefik/rules/"
  watch = true

And just some extra info:

  • No, I cannot use http://0.0.0.0:8443, Unifi Controller will tell you that port is not matching the protocol
  • Their 8880 port for redirects will not work as well, 400 error comes up
  • I don't really want to use docker to run the controller (it took me 4 hours to configure the gateway (some nice reboot/provisioning loops are included)
halfer
  • 19,824
  • 17
  • 99
  • 186
Ivan Zhivolupov
  • 1,107
  • 2
  • 20
  • 39
  • You don't say if you are running traefik in docker or not. If you are, then `127.0.0.1` refers to the traefik container, and nothing in traefik container listens on `8443`, hence `Bad Gateway`. – Andrew Savinykh May 02 '19 at 04:37
  • I'd also recommend running your Unifi Controller in docker, if that's an option at all. This way, once you set it up, you will be able to move it trivially, if the need be, and you won't need to spend another 4 hours every time that happens – Andrew Savinykh May 02 '19 at 04:39

0 Answers0