ProxyPass a WebSocket connection to a UNIX socket
8,573
Ok I got it, once you have mod_proxy
and mod_proxy_wstunnel
enabled you can do this:
ProxyPass /ws/ unix:/path/to/app.sock|ws://example.com/ws/
It works well for me since I only expect to establish a ws connection on the /ws
endpoint.
Related videos on Youtube
Author by
kay
Working at my alma mater, where I studied CS in order to aid the forces of light, and thwart the forces of darkness. I'm fluent in Python, C++, C, Cython, JavaScript, CSS, HTML, (and Java if I have to). At one point I knew Haskell, Pascal, Erlang, Prolog, Matlab, but forgot most about it.
Updated on September 18, 2022Comments
-
kay almost 2 years
In Apache 2.4 you can reverse proxy an HTTP connection to a local Unix socket with: [1]
ProxyPass unix:/path/to/app.sock|http://example.com/app/name
You can reverse proxy a WebSocket connection to a local TCP socket with: [2]
ProxyPass ws://127.0.0.1:12345/app/name
But how can you reverse proxy a WebSocket connection to a Unix socket? [☹]