KiwiIRC gets 403 Forbidden from websocket path
hnz101 opened this issue · 3 comments
Today I noticed that Kiwi IRC can't connect to the websocket path. It gets rejected with 403 Forbidden and than falls back to XHR streaming.
I double checked with an direct connection to an running webircgateway without reverse proxy in front.
Unfortunately I can't see anything in the gateway log even with debug log level. Compiled in Docker with latest golang Image.
Request:
GET /webirc/kiwiirc/542/kewliq41/websocket HTTP/1.1
Host: 127.0.0.1:8067
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:95.0) Gecko/20100101 Firefox/95.0
Accept: */*
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Sec-WebSocket-Version: 13
Origin: https://kiwi.x.com
Sec-WebSocket-Extensions: permessage-deflate
Sec-WebSocket-Key: i3sD0pWgf34x6tYHmNyppg==
Connection: keep-alive, Upgrade
Sec-Fetch-Dest: websocket
Sec-Fetch-Mode: websocket
Sec-Fetch-Site: cross-site
Pragma: no-cache
Cache-Control: no-cache
Upgrade: websocket
Answer:
HTTP/1.1 403 Forbidden
Content-Type: text/plain; charset=utf-8
Sec-Websocket-Version: 13
X-Content-Type-Options: nosniff
Date: Fri, 10 Dec 2021 09:53:28 GMT
Content-Length: 10
Here are example httpd configs that show the required settings to get websockets to work with reverse proxy
Apache: https://gist.github.com/ItsOnlyBinary/3e38b66d71e51d12d7df32f739978799
Nginx: https://gist.github.com/ItsOnlyBinary/ae8d41c4542e66bb259b0f1b312c7d29
also check you did not remove any transports from webircgateway
https://github.com/kiwiirc/webircgateway/blob/master/config.conf.example#L67
Here are example httpd configs that show the required settings to get websockets to work with reverse proxy
I am using nginx with the example parameters, but it can't be the reverse proxy because it also happens when directly connecting to the golang application (see "Host: 127.0.0.1:8067")
also check you did not remove any transports from webircgateway https://github.com/kiwiirc/webircgateway/blob/master/config.conf.example#L67
I have all 3 transports included. I just changed what was necessary from the example config.
Looking at the README.md it looks like KiwiIRC should connect to something like myhost/webirc/websocket/... and not some subfolder ob myhost/webirc/kiwiirc/... ?
Perhaps there is something wrong?
it would appear i broke it when updating dependencies :(