Skip websocket? #18
Comments
|
Mmm I haven't thought about that. Probably detecting and ignoring them will be the best option, I'll look at it the next few days. |
…When a request is a socket handshake, the proxy middleware tries to hijack the connection, but the http.ResponseWritter is not the original TCP connection anymore.
|
@Equim-chan I have deployed a fix that should solve your issue. Could you try it and tell if that worked? |
|
I just ran into this issue again. |
|
I ran into the same issue just now. |
|
@SimJoSt it seems strange, there is a fix for websockets that checks the request headers (https://github.com/nicolasazrak/caddy-cache/blob/master/handler.go#L102), so if there is a |
|
getting the same when implementing cache directive like so: websockets only fail when using websockets from firefox (chrome/safari are fine) removing the cache directive resolves, but would like to dig more and figure out a real fix here |
|
so I found in this line: Line 108 in 1044b21
However, in firefox the request header for 'Connection' is actually this so perhaps we just need to change this matcher to be a little more relaxed? fyi - other projects seem to have stumbled onto the same issue: nodejs/http-parser#99 |
|
@dstull seems right, I don't have much time right now. Do you want to make a PR? |
|
hey @nicolasazrak, I believe my colleague @jumanjiman is going to give a PR a shot on this - thanks for the quick response! |
Resolves nicolasazrak#18. `Header.Get("Connection")` only returns the first value of a multi-value header. Chrome and Safari send: Connection: Upgrade But Firefox sends: Connection: keep-alive, Upgrade Therefore add logic and tests to access the Header map directly and parse the Connection header for all known cases as described in go's net/http source code for Request and Header.
|
I opened #43 to resolve this. |
Resolves nicolasazrak#18. `Header.Get("Connection")` only returns the first value of a multi-value header. Chrome and Safari send: Connection: Upgrade But Firefox sends: Connection: keep-alive, Upgrade Therefore add logic and tests to access the Header map directly and parse the Connection header for all known cases as described in go's net/http source code for Request and Header. New tests show on pass: === RUN TestWebSocketDetection --- PASS: TestWebSocketDetection (0.00s)
Cache is not appliable to websocket.
I just tested and it responsed with 502
Maybe apply a filter to detect websocket and then skip it?
The text was updated successfully, but these errors were encountered: