Unable to perform a ProxyPass

1. The problem I’m having:

I’m going to replace Apache with Caddy.
I need to obtain in Caddy following proxypass configured in Apache (running on porto 80)

ProxyPass /myapp/api http://localhost:1202/api

i.e. i need that everything that starts with myapp/api to be redirected to http://localhost:1202/api/ maintaining all path following “api”, e.g.


and so on.

2. Error messages and/or full log output:

I’m not able to obtaint that. i tried various directives and search also in this community but i was not in the position to find best solution

3. Caddy version:

Caddy v2.7.5

4. How I installed and ran Caddy:

a. System environment:


b. Command:

caddy_windows_amd64.exe fmt --overwrite
caddy_windows_amd64.exe adapt
caddy_windows_amd64.exe run

c. Service/unit/compose file:

d. My complete Caddy config:

This is my last try…

:80 {
	route /myapp/api {
		uri strip_prefix /api
		reverse_proxy localhost:1202


5. Links to relevant resources:

You’re looking for handle_path. But keep in mind:

Thanks, in the end I used following configuration:

:80 {

	# URL applicativo Rest myapp in ascolto sulla porta 1202

	handle_path /myapp/* {
		redir /myapp/ /api/
		reverse_proxy localhost:2002


This doesn’t do anything, because /myapp/ is already stripped away from the request at this point. You can remove that line.

Also, make sure you have handling for other request paths, otherwise Caddy will just write an empty response.

1 Like

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