The issue is that the reverse_proxy
is handling all requests before it reaches file_server
. Caddy doesn’t know otherwise which requests should avoid using the proxy and which should be handled via the file server.
When using the Caddyfile, directives are handled in a specific order, described in the following docs page. Specifically, reverse_proxy
is ordered higher than file_server
, so it’ll get handled first if a request matched by it (most directives match all requests by default).
To solve this, you’ll need to use a named matcher that excludes the reverse_proxy
directive from handling requests to /static/*
.
It’ll look something like this:
@notStatic {
not path /static/*
}
reverse_proxy @notStatic 127.0.0.1:9000