Config for reverse proxy

1. The problem I’m having:

Hi guys,
I am completely new to Caddy and I need your help settings up caddy as reverse proxy.
Following situation:
I have a host with a docker environment.
My plan is to run caddy as reverse proxy as a docker container.
Caddy should now route as follows:
If I open the URL https://server.local/service-a
it should route to a docker container service-a on port 3000 (Grafana).
If I open the URL https://server.local/service-b
it should route to a docker container service-a on port 8086 (InfluxDB)
I have a falid certificate for server.local.
How must I setup my Caddyfile, that the connection to the containers are secure?
I guess I have to setup an internal docker network between the containers.
Is there anything else?
BR
crazy

2. Error messages and/or full log output:


3. Caddy version:

2.10.2

4. How I installed and ran Caddy:

installed via docker compose

a. System environment:

Docker

b. Command:

c. Service/unit/compose file:

d. My complete Caddy config:


5. Links to relevant resources:

If both backend apps are HTTP/S based, the Caddy configuration can be as simple as:

server.local {

	tls certificate_file key_file
 
	redir /service-a /service-a/
	handle_path /service-a* {
		reverse_proxy service-a:3000
	}

	redir /service-b /service-b/
	handle_path /service-b* {
		reverse_proxy service-a:8086
	}
}

with some small adjustments, depending on your situation. Make sure you understand the subfolder problem, in case you run into some weird behaviour with your apps.

If any of these apps is not HTTP/S based (I’m guessing InfluxDB is such app), you may need to look at:

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