1. Caddy version (caddy version
):
v2.1.1 h1:X9k1+ehZPYYrSqBvf/ocUgdLSRIuiNiMo7CvyGUQKeA=
2. How I run Caddy:
a. System environment:
Debian GNU/Linux v10
b. Command:
Caddy is run as a service (installed via apt)
sudo service caddy start
c. Service/unit/compose file:
N/A
d. My complete Caddyfile or JSON config:
(was giving me an error about port missing before adding 443 so that’s why that’s there)
chat.websocket.ws {
reverse_proxy * 6only.chat.websocket.ws:443
}
3. The problem I’m having:
Ok, so I have an IPv6 only websocket server (running correctly [using caddy]) @ wss://6only.chat.websocket.ws
This is working fine (I’m using caddy on that server to handle SSL) - I can connect from my app and send messages.
The server that I’m having ths issue with is the one that has IPv4, I’m using it as a reverse proxy for the users who don’t have IPv6 (Like myself - I’m using a SOCKS proxy to test the IPv6 only server)
I did try sending my server with both IPv 4 & 6 directly to the backend avoiding caddy (no tls, so I don’t want to use it) and that works just fine, so I wonder if TLS might be part of the issue?
4. Error messages and/or full log output:
Aug 25 17:24:04 nftmart caddy[31337]: {"level":"error","ts":1598376244.2511349,"logger":"http.handlers.reverse_proxy","msg":"reading from backend","error":"read tcp [2a07:e01:3:2b::1]:50818->[2a07:e01:3:1d::1]:443: read: connection reset by peer"}
Aug 25 17:24:04 nftmart caddy[31337]: {"level":"error","ts":1598376244.2530627,"logger":"http.handlers.reverse_proxy","msg":"aborting with incomplete response","error":"read tcp [2a07:e01:3:2b::1]:50818->[2a07:e01:3:1d::1]:443: read: connection reset by peer"}
Aug 25 17:25:04 nftmart caddy[31337]: {"level":"error","ts":1598376304.5920196,"logger":"http.handlers.reverse_proxy","msg":"reading from backend","error":"read tcp [2a07:e01:3:2b::1]:50830->[2a07:e01:3:1d::1]:443: read: connection reset by peer"}
Aug 25 17:25:04 nftmart caddy[31337]: {"level":"error","ts":1598376304.5921538,"logger":"http.handlers.reverse_proxy","msg":"aborting with incomplete response","error":"read tcp [2a07:e01:3:2b::1]:50830->[2a07:e01:3:1d::1]:443: read: connection reset by peer"}
Aug 25 17:26:05 nftmart caddy[31337]: {"level":"error","ts":1598376365.4409103,"logger":"http.handlers.reverse_proxy","msg":"reading from backend","error":"read tcp [2a07:e01:3:2b::1]:50838->[2a07:e01:3:1d::1]:443: read: connection reset by peer"}
Aug 25 17:26:05 nftmart caddy[31337]: {"level":"error","ts":1598376365.4410937,"logger":"http.handlers.reverse_proxy","msg":"aborting with incomplete response","error":"read tcp [2a07:e01:3:2b::1]:50838->[2a07:e01:3:1d::1]:443: read: connection reset by peer"}
Aug 25 17:27:05 nftmart caddy[31337]: {"level":"error","ts":1598376425.9898794,"logger":"http.handlers.reverse_proxy","msg":"reading from backend","error":"read tcp [2a07:e01:3:2b::1]:50842->[2a07:e01:3:1d::1]:443: read: connection reset by peer"}
Aug 25 17:27:05 nftmart caddy[31337]: {"level":"error","ts":1598376425.9900362,"logger":"http.handlers.reverse_proxy","msg":"aborting with incomplete response","error":"read tcp [2a07:e01:3:2b::1]:50842->[2a07:e01:3:1d::1]:443: read: connection reset by peer"}
Aug 25 17:28:06 nftmart caddy[31337]: {"level":"error","ts":1598376486.6543398,"logger":"http.handlers.reverse_proxy","msg":"reading from backend","error":"read tcp [2a07:e01:3:2b::1]:50852->[2a07:e01:3:1d::1]:443: read: connection reset by peer"}
Aug 25 17:28:06 nftmart caddy[31337]: {"level":"error","ts":1598376486.6544511,"logger":"http.handlers.reverse_proxy","msg":"aborting with incomplete response","error":"read tcp [2a07:e01:3:2b::1]:50852->[2a07:e01:3:1d::1]:443: read: connection reset by peer"}
5. What I already tried:
So I have tried the following:
Connecting directly to the backend, which did work [Backend doesn’t have tls and I don’t want to send this data plaintext].
Removing the port from the above config
Aug 25 17:36:49 nftmart caddy[31720]: {"level":"info","ts":1598377009.8251972,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
Aug 25 17:36:49 nftmart caddy[31720]: {"level":"info","ts":1598377009.8321679,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["localhost:2019","[::1]:2019","127.0.0.1:2019"]}
Aug 25 17:36:49 nftmart caddy[31720]: {"level":"info","ts":1598377009.8328273,"logger":"http","msg":"server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS","server_name":"srv0","https_port":443}
Aug 25 17:36:49 nftmart caddy[31720]: 2020/08/25 17:36:49 [INFO][cache:0xc00012bce0] Started certificate maintenance routine
Aug 25 17:36:49 nftmart caddy[31720]: {"level":"info","ts":1598377009.8328917,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
Aug 25 17:36:49 nftmart caddy[31720]: {"level":"info","ts":1598377009.84113,"logger":"tls","msg":"cleaned up storage units"}
Aug 25 17:36:49 nftmart caddy[31720]: {"level":"info","ts":1598377009.8414717,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["phpmyadmin.ws2.nftm.art","nextcloud.nftm.art","chat.websocket.ws","phabricator.nftm.art","nftmart-files-phabricator.websocket.ws"]}
Aug 25 17:36:49 nftmart caddy[31720]: {"level":"info","ts":1598377009.8725863,"msg":"autosaved config","file":"/var/lib/caddy/.config/caddy/autosave.json"}
Aug 25 17:36:49 nftmart caddy[31720]: {"level":"info","ts":1598377009.8730967,"msg":"serving initial configuration"}
Aug 25 17:37:12 nftmart caddy[31720]: {"level":"error","ts":1598377032.8222232,"logger":"http.log.error","msg":"making dial info: upstream 6only.chat.websocket.ws:: invalid dial address 6only.chat.websocket.ws:: invalid start port: strconv.ParseUint: parsing \"\": invalid syntax","request":{"method":"GET","uri":"/","proto":"HTTP/1.1","remote_addr":"[2a07:e01:3:2b::1]:54494","host":"chat.websocket.ws","headers":{"Accept-Encoding":["gzip, deflate, br"],"Sec-Websocket-Version":["13"],"Sec-Websocket-Key":["/1C+h7QWNyuoNORAEXg/EA=="],"Dnt":["1"],"Connection":["keep-alive, Upgrade"],"Accept":["*/*"],"Sec-Websocket-Extensions":["permessage-deflate"],"Cache-Control":["no-cache"],"Upgrade":["websocket"],"Accept-Language":["en-GB,en;q=0.5"],"Origin":["https://hoppscotch.io"],"Pragma":["no-cache"],"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:79.0) Gecko/20100101 Firefox/79.0"]},"tls":{"resumed":true,"version":772,"ciphersuite":4865,"proto":"http/1.1","proto_mutual":true,"server_name":"chat.websocket.ws"}},"duration":0.000120127}
Connecting directly to the ipv6 ip to the backend (didn’t work) with or without port
Adding https:// to the address and taking away port (doesn’t work) - Leads To Similar Outcome:
Poorly drawn diagram because I don’t always explain well:
6. Links to relevant resources:
7. Footnotes
If you want to test it, only selected origins are allowed. Use: https://hoppscotch.io/realtime