1. Output of caddy version
:
v2.6.2 h1:wKoFIxpmOJLGl3QXoo6PNbYvGW4xLEgo32GPBEjWL8o=
2. How I run Caddy:
container on debian 11.5 amd64
a. System environment:
debian 11.5 amd64
docker
host network
b. Command:
docker run --rm -it --net=host -v $PWD/Caddyfile:/etc/caddy/Caddyfile -v $PWD/config:/config -v $PWD/data:/data chain710/caddy:v2.6.2-1
chain710/caddy:v2.6.2-1 is built with plugins:
github.com/mastercactapus/caddy2-proxyprotocol
github.com/mholt/caddy-l4
c. Service/unit/compose file:
no compose file
d. My complete Caddy config:
{
admin off
email me@example.com
skip_install_trust
servers :9443 {
listener_wrappers {
proxy_protocol {
timeout 2s
allow 192.168.1.1/16
}
tls
}
}
}
localhost {
respond "hello, world"
}
example.com:9443 {
log {
output stderr
}
reverse_proxy http://localhost:3000 {
trusted_proxies private_ranges
}
}
3. The problem I’m having:
example.com:9443
serve behind another proxy(frp), which expose 443 port
Visit http://example.com
redirect to https://example.com:9443/
curl -i http://example.com
HTTP/1.1 308 Permanent Redirect
Content-Length: 0
Location: https://example.com:9443/
Server: Caddy
The reason I can not use 443 on example.com
is:
I prefer localhost use 443 port
while example.com
with proxy_protocol must listen another port
This problem can be solved in nginx with option
port_in_redirect off;
I wonder if there is similar option in caddy?
4. Error messages and/or full log output:
No log needed.
5. What I already tried:
Nothing
6. Links to relevant resources:
http://nginx.org/en/docs/http/ngx_http_core_module.html#port_in_redirect