Subdir reverse_proxy fails while subdomain reverse_proxy works perfectly

1. Output of caddy version:

2.5.2

2. How I run Caddy:

caddy start

a. System environment:

5.15.63-0-lts #1-Alpine SMP Mon, 29 Aug 2022 07:17:28 +0000 x86_64 Linux

b. Command:

caddy start

c. Service/unit/compose file:

NA

d. My complete Caddy config:

wp.home.arpa {
        encode gzip
        reverse_proxy localhost:8080
        file_server
        @disallowed {
               path /xmlrpc.php
               path *.sql
               #path /wp-content/uploads/*.php
        }
        rewrite @disallowed '/index.php'
        reverse_proxy /xr/* 127.0.0.1:3000
}
xr.home.arpa {
        @blocked not remote_ip 10.0.0.1/24
        respond @blocked "<h1>Access Denied</h1>" 403
        reverse_proxy 127.0.0.1:3000
}

3. The problem I’m having:

While xr.home.arpa works brilliantly, wp.home.arpa/xr/ fails, showing:
Cannot GET /mc/

4. Error messages and/or full log output:

No errors,  just does not work.

5. What I already tried:

I tried using handle, handle_path, route, had to learn about without not working… I can easily do this in traefik (which is crazy since I moved to caddy to to traefik breaking from being so complex)

6. Links to relevant resources:

See this article, which explains:

1 Like

Thank you for the article. It certainly explains the issue. It looks like subdomains are the way to go, as the advanced option looks much more difficult. Thank you @francislavoie !

1 Like

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