One reverse proxy with SSL but two diff endpoints?

1. Caddy version (caddy version):

v2

2. How I run Caddy:

run as a docker container

a. System environment:

Docker

b. Command:

Not sure what the command would be, that's sort of what I'm trying to learn

c. Service/unit/compose file:

N/A (I think)

d. My complete Caddyfile or JSON config:

simply using the default within caddy's docker image

3. The problem I’m having:

I’d like to spin up a caddy container that handless ssl but will proxy to either a container handling /api requests or a different container handling /api/v2 requests.

4. Error messages and/or full log output:

N/A

5. What I already tried:

I scanned the docs a bit but didn’t immediately see something about this sort of thing

6. Links to relevant resources:

You Caddyfile might look like:

example.com {
	handle /api/v2* {
		reverse_proxy apiv2:8080
	}

	handle /api/* {
		reverse_proxy apiv1:8080
	}

	handle {
		# Fallback for otherwise unhandled requests
	}
}

See the docs on Docker Hub

Thank you so much, this is def what I was envisioning, not sure why I was having such a hard time finding it

1 Like

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