1. The problem I’m having:
I’m having a small problem with the Caddy Reverse Proxy. I want to redirect to another machine by accessing a subdirectory (like “www.domain.com/subdirectory”). I can’t get it to work.
The following code works in caddyfile (without call a subdirectory):
www.domain.com {
uri strip_prefix /foo
reverse_proxy {
to https://synology-nas.local:5001
transport http {
tls_insecure_skip_verify
}
}
}
When I now access "
https://www.domain.com/foo" in my browser, it correctly redirects to "https://synology-nas.local:5001" and a login window appears.
What doesn't work in caddyfile:
www.domain.com {
handle /foo {
uri strip_prefix /foo
reverse_proxy {
to https://synology-nas.local:5001
transport http {
tls_insecure_skip_verify
}
}
}
}
When I access "
https://www.domain.com/foo" in my browser, a blank white page is displayed.
I've also tested this with other destinations (Fritz!Box, Proxmox PVE), which also didn't work. However, if the destination is a simple HTML website, then this method works. It's just more complex destinations that don't work.
I've already tried several settings (for example, "route" instead of "handle" or "replace" instead of "strip_prefix"), but all without success. I'm really hoping someone here can help. If you have any further questions, I'd be happy to answer them.
Greetings, Peter
Additional:
Caddy version: Caddy v2.11.2
Installed with docker.