I have 10 docker containers with allure-report. For example i use only two.
I need to proxy requests to specific ports, depending on the transmitted URI
For example:
GET allure.myproject.dev/14 → :5058/latest-report
GET allure.myproject.dev/13 → :5056/latest-report
But config in my Caddyfile dont work as i want. When i make request, i see blank page in response and status code 200. But when i change config to below, i see what i need (I make request on allure.myproject.dev/latest-report)
allure.myproject.dev {
reverse_proxy :5058
}
what should i do in my case? Cant find information.
Remove this from your Dockerfile. The default command is ideal.
You should copy this to /etc/caddy/Caddyfile instead, which is what the default command uses.
Path matching is exact in Caddy. This means that only the path /14 will match, and nothing else. If you mean to proxy everything under that subpath, then use /14* instead.
Since handle_path strips the path prefix before continuing (the handle directive doesn’t strip the path), the path no longer is /14 at this point. So instead, you should do rewrite * /latest-report if you want to rewrite every request that reaches this handle.
UPD.
i need to reverse-proxy requests from allure.myproject.dev/13 to 127.0.0.1:5056/latest-report and allure.myproject.dev/14 to 127.0.0.1:5058/latest-report