1. Caddy version (caddy version
):
2.4.6
2. How I run Caddy:
docker run caddy with my custom Caddyfile
a. System environment:
MacOS
The Question
I am migrating from nginx to Caddy, to reverse proxy my websites.
When users visit my domain, I want to show content that is in a subpath of another domain.
The upstream server has the content in subfolders I don’t want the users see it. It must be transparent to the users.
In nginx, it works like this. Notice that I can inform the subfolder in the proxy_pass configuration:
location /api/v4/ {
# proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass https://easypnr.github.io/slate-easypnr-api-v4/;
proxy_pass_request_headers on;
}
How to do it in Caddy? I tried many configurations but I couldn’t find a solution. In the reverse_proxy configuration can only have scheme, host and port, and neither paths or parameters:
localhost {
reverse_proxy https://easypnr.github.io {
#how to setup the upstream subfolder here?
}
}
So to summary up, when user visit http://localhost
I want to show the content of https://easypnr.github.io/slate-easypnr-api-v4/
without changing the URL the user sees.