Why is it redirecting to an IP whilst proxying?

I’m running Docker Hub with Caddy infront of it.

With the config:

smokeping.dabase.com {
    tls me@example.com
    proxy / 192.168.1.4:8080
    log stdout
    errors stdout
    header / {
        X-Robots-Tag "noindex"
    }
}

But it redirects to 192.168.1.4… why?

Just to be unambigious, “it” here is the upstream app itself; Smokeping is issuing the redirect, and Caddy faithfully returns it to the downstream client.

As for why, it’s fairly simple; Smokeping appears to generate Location headers contextually aware of the Host header the client used to access the site.

Smokeping sees a request for Host: 192.168.1.4, which is true for Caddy, but not relevant for the actual client downstream - the client wants smokeping.dabase.com.

You can pass through the Host header, along with a few other useful headers for backend apps to get actual client-relevant information, with the transparent preset for the proxy directive.

https://caddyserver.com/docs/proxy#presets

1 Like

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