Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Set reverse proxy websockets in Apache 2.4 using 1.0. Needs mod_rewrite module, this version uses SSL. As seen here
<VirtualHost *:80>
Redirect permanent /
<VirtualHost *:443>
SSLEngine on
SSLProtocol all -SSLv2
SSLCertificateFile /etc/apache2/ssl/example-com/forum.ssl.crt
SSLCertificateKeyFile /etc/apache2/ssl/example-com/private.key
SSLCertificateChainFile /etc/apache2/ssl/example-com/
# ServerAdmin webmaster@localhost
<Proxy *>
Require all granted
ProxyRequests off
ProxyVia on
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/ [NC]
RewriteCond %{QUERY_STRING} transport=websocket [NC]
RewriteRule /(.*) ws://localhost:4567/$1 [P,L]
ProxyPass / http://localhost:4567/
ProxyPassReverse / http://localhost:4567/
<Location />
ErrorLog /home/username/logs/apache/forum-error.log
CustomLog /home/username/logs/apache/forum-access.log combined

This comment has been minimized.

Copy link

@osiztechnologies osiztechnologies commented Mar 27, 2020

We have tried this conf. but its not working. Kindly advise us.


This comment has been minimized.

Copy link

@ak2766 ak2766 commented Jun 15, 2020

Thanks so iacchus - these instructions are the only ones that worked for me. All others just lead me down a rabbit hole that was never ending.

Only question - I noticed that Apache takes a long long time to complete a restart - is this expected? I also noticed that If I refresh (or close the page) when Apache is hung on restart, it completes the restart immediately. What can be done to ensure it restarts immediately?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.