I’ve been working with the flask-Socketio library that allows for the Python Flask web framework to be used with Socket.io. This is websocket technology. I searched the forums and also the bug reports for caddy, but I couldn’t find a complete example detailing how to set up the websocket.
I am using caddy version 0.9.1.
Using the Caddyfile listed below, the browser console (Chrome, on Windows 10) shows a number of errors related to GET (net::ERR_ADDRESS_IN_USE). Is there a complete example showing how to set up a websocket proxy?
@gyufa Sorry, I don’t have an update to share on this issue. I actually had to switch to nginx, and this works fine. Too bad that caddy doesn’t work with flask-sockio.
@n.kinar I’ve spent some time playing around with this, and I’m glad to tell you that it seems to be resolved on the master branch. The related issue was https://github.com/mholt/caddy/issues/1056 and the commit that fixed it is https://github.com/mholt/caddy/pull/1062. There is no official release with this fix since 0.9.1, but you can compile a binary from source if it’s still not too late. If you use Docker, I can share an image with you.
@gyufa That’s great, thanks so much for letting me know! I’m not using Docker at this time, but I will pull the latest development version, compile it and then post back here.
Once again, thank you - I like caddy better than the other alternatives.
@gyufa: I can now confirm that the most recent version of caddy works well with websockets, socket.io, and flask-socket.io. Thanks again for your help!
For the record:
I downloaded and built caddy using:
go get github.com/mholt/caddy/caddy
Here is the complete caddyfile that works well. Note how socket.io is being proxied: