Does caddy have option equivelant to nginx port_in_redirect?

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
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:


c. Service/unit/compose file:

no compose file

d. My complete Caddy config:

        admin off
        servers :9443 {
                listener_wrappers {
                        proxy_protocol {
                                timeout 2s

localhost {
        respond "hello, world"
} {
        log {
                output stderr
        reverse_proxy http://localhost:3000 {
                trusted_proxies private_ranges

3. The problem I’m having: serve behind another proxy(frp), which expose 443 port
Visit redirect to

curl -i
HTTP/1.1 308 Permanent Redirect
Content-Length: 0
Server: Caddy

The reason I can not use 443 on is:
I prefer localhost use 443 port
while 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:


6. Links to relevant resources:

No we don’t have an option like that. But you can turn off the redirects with auto_https disable_redirects and then do them yourself with a site block like this: {
	redir https://{host}{uri}

But maybe I don’t understand what you’re trying to do exactly. I’m kinda confused by your explanation.

This topic was automatically closed after 30 days. New replies are no longer allowed.