"Hijacked" Connection


(J. Scott Elblein) #1

I just noticed these errors popping up semi-frequently in my caddy log. Anyone know what it is?

2019/04/10 16:50:28 http: response.WriteHeader on hijacked connection from github.com/mholt/caddy/caddyhttp/httpserver.(*ResponseRecorder).WriteHeader (recorder.go:61)
2019/04/10 16:50:28 http: response.Write on hijacked connection from github.com/mholt/caddy/caddyhttp/httpserver.(*ResponseRecorder).Write (recorder.go:67)

Caddy 0.11.5


(Matthew Fay) #2

Hmm, haven’t seen this one before myself. What’s in your Caddyfile?

Quick Googling indicates it’s probably got to do with websockets (specifically, the writer’s being used after the connection was upgraded).


(J. Scott Elblein) #3

Heyas Matthew,

Here’s my entire caddyfile as of the moment.


(J. Scott Elblein) #4

One thing that comes to mind, though not really seeing any direct mentions of it, is I recently added some code using the Filter plugin to change the Deluge webui theme (you might remember our thread on it). I wonder if for some reason it’s thinking the re-writing of the response is a ‘hijack’?


(Matthew Fay) #5

That’s a good point. It’s possible that http.filter is trying to do something here…

That said, going off your Caddyfile, the filtering should be scoped to /delugedoc while the websockets are present elsewhere.

Can you narrow down a request that can be used to reproduce the log entry? Might be worth testing without one of those elements (filter or websocket) if you can.