Caddyfile no longer working after 2.7 update

1. The problem I’m having:

I am trying to run a websocket out of my cloud server and connect to it using postman to confirm the connection. Below is my caddy file I’ve had for some time working without error:

test.therapidbox.com {
        @ws {
                header Connection Upgrade
                header Upgrade websocket
        }
        reverse_proxy @ws 0.0.0.0:7003
        log {
                output file /var/log/caddy/test.therapidbox.com.log
                level debug
        }
}

test.therapidbox.com:6002 {
        @ws {
                header Connection Upgrade
                header Upgrade websocket
        }
        log {
                output file /var/log/caddy/test.therapidbox.com.log
        }
        reverse_proxy @ws 0.0.0.0:7002
}

test.therapidbox.com:6005 {
        @websockets {
                header Connection Upgrade
                header Upgrade websocket
        }
        reverse_proxy @websockets 0.0.0.0:7005
        log {
                output file /var/log/caddy/test.therapidbox.com.log
                level debug
        }
}

Using this caddyfile, when I start my websocket server on port 7003, & use postman to connect with:

wss://test.website.com

I successfully receive the data that is streamed through :+1:
However when I start my websocket server on port 7005 now, where it would typically behave the same, i now get

 **Error:** connect ETIMEDOUT

previously on caddy 2.6.3 this style of configuration seemed to be running just fine. It feels like there might

2. Error messages and/or full log output:

for some reason my journal is getting no entries either.

3. Caddy version:

v2.7.3 h1:eMCNjOyMgB5A1KgOzT2dXKR4I0Va+YHCJYC8HHu+DP0=

4. How I installed and ran Caddy:

a. System environment:

Ubuntu 20.04
caddy v2.7.3 h1:eMCNjOyMgB5A1KgOzT2dXKR4I0Va+YHCJYC8HHu+DP0=
followed digital ocean tutorial style for setup
customized caddy config as shown above

b. Command:

I can confirm caddy is running when I switch back & forth between the ports as described above and run

sudo systemctl caddy restart

c. Service/unit/compose file:

d. My complete Caddy config:

test.therapidbox.com {
        @ws {
                header Connection Upgrade
                header Upgrade websocket
        }
        reverse_proxy @ws 0.0.0.0:7003
        log {
                output file /var/log/caddy/test.therapidbox.com.log
                level debug
        }
}

test.therapidbox.com:6002 {
        @ws {
                header Connection Upgrade
                header Upgrade websocket
        }
        log {
                output file /var/log/caddy/test.therapidbox.com.log
        }
        reverse_proxy @ws 0.0.0.0:7002
}

test.therapidbox.com:6005 {
        @websockets {
                header Connection Upgrade
                header Upgrade websocket
        }
        reverse_proxy @websockets 0.0.0.0:7005
        log {
                output file /var/log/caddy/test.therapidbox.com.log
                level debug
        }
}

5. Links to relevant resources:

You only need the @ws matcher if you’re also doing anything else in those routes. It does nothing on its own. In every case, you can simply do reverse_proxy 0.0.0.0:7002.

You should probably be doing reverse_proxy localhost:7002 though, 0.0.0.0 technically means “all interfaces”, and it only works as “localhost” by coincidence.

That said, please enable the debug global option and show your Caddy logs. Make an example request with curl -v and show what you see. You haven’t really shown any evidence of a problem.

1 Like

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