Re using domain name after changing IP of server

(Goswijn Thijssen) #1

Using Caddy for a while now and never had to touch it for over 6 months. All worked fine.

However I just had to move my Unifi controller software to another server on another IP adress.

My Caddyfile entry for this was: {
    proxy / {

I now move to However if I just change the IP in the caddyfile I get a “502 bad gateway” if I call ‘

Maybe something with a CERT? I have no idea. Suggestions welcome.

(Toby Allen) #2

Can you see theunifi controller at that up without the caddy proxy?

(Goswijn Thijssen) #3

Yes, sure. If go to “” I get the unifi controller. Also my other entries in de caddyfile still work correctly.

Just for completness: this https server does not have a valid certificate (if I visit via entry of the IP) but neither did the previous server.

(Toby Allen) #4

Don’t take this question wrong but I assume you have restarted caddy after changing the caddy file?

(Goswijn Thijssen) #5

Sure. Re-started the server (incl. rebooting the Pi).

p.s. the new server actually seems to (also) have something running at port 80 (The previous server did not have). Unfortunately I can’t change that one to another port. Can this be related?

(Matthew Fay) #6

It’s gotta be somewhere between the Caddy host and the upstream.

I know you said that it works if you browse to yourself, but can you curl it from the Caddy host?

I doubt that running something on port 80 is affecting the situation.

(Michael Munson) #7

I’ve had lots of trouble trying to proxy to unifi controllers. The unifi controller changes the HTTP location which can tend to break proxies if whatever it tries to redirect to isn’t proxied also.

However, instead of trying to fix it I’d recommend looking into the Ubiquiti Beta Network Monitoring System:

You can run it on a $5 digitalocean VPS or whatever network assets you have available. It’s nice because it also works on the Ubiquiti edgemax routers/etc as well as a unifi.

Otherwise what I would do would be just to run SSHD on the raspberry pi and then use a SSH tunnel to access the unifi controller, it’s more of a pain in the ass but it will work consistently.

(Matthew Fay) #8

Alternately, use their NAT-punching cloud controller at to connect to your controller via WebRTC.

(Toby Allen) #9

What happens if you specifically got to

(Goswijn Thijssen) #10

Actually now using this solution (Unify CloudKey with cloud access enabled). Accessing it via cloud access not needing any proxy. So I have a solution allowing me safe access from remote location now. However still surprised my ‘old’ solution via Caddy does not work anymore.

(Goswijn Thijssen) #11

Now using solution below but to answer your question; This also gave ‘502 bad gateway’

(system) closed #12

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.