Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage behind a apache/nginx reverse proxy #128

Open
tzvc opened this issue Dec 10, 2019 · 1 comment
Open

Usage behind a apache/nginx reverse proxy #128

tzvc opened this issue Dec 10, 2019 · 1 comment

Comments

@tzvc
Copy link

tzvc commented Dec 10, 2019

Hi there,

I'm trying to use express-ws on my application sitting behind a Apache2 reverse proxy but I can't get it to work, I keep getting

WebSocketException: Connection to 'https://blablamyapi.net/ws' was not upgraded to websocket

Thing is everything works properly on local so I suspect that the problem is the reverse proxy on my remote server is not letting the websocket upgrade requests through properly.
I tried a few solution found online for my apache config:

<IfModule mod_ssl.c>
<VirtualHost *:443>
	ServerName blablamyapi.te
	ServerAlias blablamyapi.te

	ProxyPreserveHost On

	RewriteEngine on
	RewriteCond %{HTTP:Upgrade} websocket [NC]
	RewriteCond %{HTTP:Connection} upgrade [NC]
	RewriteRule .* "wss://0.0.0.0:3030%{REQUEST_URI}" [P]

	ProxyPass / http://0.0.0.0:3030/
	ProxyPassReverse / http://0.0.0.0:3030/

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined




</VirtualHost>
</IfModule>

Have anyone manage to do this before? What am I missing here?

@taxilian
Copy link

does your apache server support websocket tunneling? A quick google search came up with https://httpd.apache.org/docs/2.4/mod/mod_proxy_wstunnel.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants