Grouping multiple reverse_proxy

1. The problem I’m having:

Issue when trying to group multiple domains to mutliple reverse_proxy (not sure if possible)

having multiple subdomains and servers it would be helpful, is there a way?

2. Error messages and/or full log output:

Error: adapting config using caddyfile: parsing caddyfile tokens for 'reverse_proxy': unrecognized subdirective http://jellyfin:8096, at /etc/caddy/Caddyfile:45

3. Caddy version:

4. How I installed and ran Caddy:

a. System environment:

Debian 12 x64 - Docker built with ionos dns challenge

b. Command:

N/A

c. Service/unit/compose file:

N/A

d. My complete Caddy config:

(ionos) {
	tls {
		dns ionos mykey
	}
}

https://truenas.domain.com, https://jellyfin.domain.com, https://backrest.domain.com {
        reverse_proxy {
		    http://192.168.0.2
		    http://jellyfin:8096
		    http://192.168.0.3:9898
	}
        import ionos
}

5. Links to relevant resources:

You can’t do it like that. Caddy needs to know which domain goes to which upstream. So you need to split it into separate site blocks. Caddy can’t magically know which is which.

With that config (if you used the correct syntax with to, see the docs) then if you made a request to say truenas.domain.com you would randomly get served either truenas or jellyfin or backrest. That obviously makes no sense.

The point of specifying multiple upstreams in reverse_proxy is if you have multiple copies of the same type of service for load balancing.

1 Like

Thanks! I mistakenly assumed that it was by order 1, 2, 3

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