1. Caddy version (caddy version
):
v2.0.0 h1:pQSaIJGFluFvu8KDGDODV8u4/QRED/OPyIR+MWYYse8=
2. How I run Caddy:
I am trying to reverse proxy a socket.io
server from https://example.vaaski.dev/test
to localhost:6969/test. I’m used Caddy v1 for over a year now and I’m impressed how good it runs after setting it up. But it seems like support for v1 is phasing out soon and I’d like to switch to v2.
My main usecase is socket.io
servers, which I’d like to proxy from a path on my subdomain to a local port. My (working) v1 config looks like this:
server.vaaski.dev {
proxy /path localhost:6969/socket.io {
header_upstream Host {host}
header_upstream X-Real-IP {remote}
header_upstream X-Forwarded-For {remote}
websocket
}
header /path {
Access-Control-Allow-Origin https://app.vaaski.dev
Access-Control-Allow-Credentials true
}
}
And this is the config I am trying on v2 (not working):
server.vaaski.dev {
respond /test "Hello World!"
reverse_proxy /path {
to localhost:6969/socket.io{uri}
header_up Host {host}
header_up X-Real-IP {remote}
header_up X-Forwarded-For {remote}
}
header /path/* {
Access-Control-Allow-Origin https://app.vaaski.dev
Access-Control-Allow-Credentials true
}
}
a. System environment:
Raspbian Lite GNU/Linux 10 (buster) on Raspberry Pi 3
b. Command:
caddy run --watch
d. My complete Caddyfile or JSON config:
see above
3. The problem I’m having:
I cannot get a socket.io
connection to work on v2.
4. Error messages and/or full log output:
This depends on how exactly its configured.
With the v2 config above it just replies with an empty 200 OK
to socket.io
's GET request instead of some upgrade data, but with /*
added to the matcher I run into a 500
error with caddy telling me something along the lines of ERROR http.log.error making dial info: upstream localhost/socket.io:6969{http.request.uri}: invalid dial address localhost/socket.io:6969/light/?EIO=3&transport=polling&t=NAwZ_lA
5. What I already tried:
I’ve tried many small adjustments and changes for the v2 config, such as adding /*
to the end of the reverse_proxy matcher, adding and removing {uri}
to the upstream, moving the port around in the upstream, but I can’t get it to work.
6. Links to relevant resources:
I’d be happy to provide some example files to test for both v1 and v2 to test and any more info you could need. Thanks in advance <3