Reverse proxy only websockets

How can I use both the file server and reverse proxy, such that regular HTTP requests can be made to get files (./client), but any websocket traffic (only) is proxied back to a websocket server I have running locally (

Whenever I try running both at once, any HTTP requests also get proxied, which is undesired.

Running the file server alone serves files fine, but I need to proxy a WS connection too.

I can’t find any clarification about how HTTP/WS are differentiated in the docs.



root * ./client


You use request matchers for this:

There’s even an example in there for matching websocket requests!

@websockets {
	header Connection *Upgrade*
	header Upgrade    websocket
reverse_proxy @websockets

Oh, cool. How did I miss that, thanks. Works now.

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.