Remove path prefix on reverse_proxy

1. Caddy version (caddy version):

v2.4.6

2. How I run Caddy:

caddy start

a. System environment:

debian OS

d. My complete Caddyfile or JSON config:

test.example.com {
 reverse_proxy /api/*  localhost:9000
}

3. The problem I’m having:

I want to remove the path api from uri
A call to https://test.example.com/api/__health will need to proxy to localhost:9000/__health
currently it hits localhost:9000/api/__health

You can use handle_path for this:

handle_path /api/* {
	reverse_proxy localhost:9000
}

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