Reputation: 3
I got Caddy from official repo on docker hub all up and running with automatic https on several subdomains. So far so good.
sub1.domain.com {
respond "Test"
}
https://sub1.domain.com:3333 {
reverse_proxy 192.168.7.6:3000
}
https://sub1.domain.com:4444 {
reverse_proxy 192.168.7.6:4000
}
sub2.domain.com {
respond "Test"
}
There are two things I do not understand.
1) I would rather have the proxy working on subdirs forwarding to ports, but this fails, as the dir seems to be maintained as well while proxying. Example:
https://sub1.domain.com:4444 {
reverse_proxy /dir/ 192.168.7.6:4000
}
So eventually I end up at 192.168.7.6:4000/dir/ instead of only 192.168.7.6:4000
2) When I call sub2.domain.com combined with a port from sub1 it shows a blank page (source empty as well). So for example sub2.domain.com:4444. I would rather expect a timeout or error page?
Many thanks for hints and suggestions in advance!
Upvotes: 0
Views: 8016
Reputation: 23729
Matching requests does not rewrite them. So, matching on /dir/
does not change the URI of the request. It's simply a filter.
To strip a path prefix, you can do:
uri strip_prefix /dir
Since this is pretty common, there's some work to make this even easier in the future: https://github.com/caddyserver/caddy/pull/3281
For more help, feel free to ask on our forums, the audience there is much better targeted for Caddy users: https://caddy.community
Upvotes: 3