Closed welbert closed 7 years ago
You have to make sure the websocket is being sent through the reverse proxy. Try something like this:
<VirtualHost *:443>
ServerName notica.us
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/sockjs-node [NC]
RewriteRule /(.*) ws://localhost:3000/$1 [P,L]
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/socket.io [NC]
RewriteCond %{QUERY_STRING} transport=websocket [NC]
RewriteRule /(.*) ws://127.0.0.1:3000/$1 [P,L]
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/socket.io [NC]
RewriteRule /(.*) http://127.0.0.1:3000/$1 [P,L]
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
ProxyPreserveHost On
SSLEngine on
SSLCertificateFile "/etc/letsencrypt/live/notica.us/cert.pem"
SSLCertificateChainFile "/etc/letsencrypt/live/notica.us/fullchain.pem"
SSLCertificateKeyFile "/etc/letsencrypt/live/notica.us/privkey.pem"
SetOutputFilter DEFLATE
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Replace notica.us with your domain name, and port 3000 with the one Notica is running on.
I'm tried configure to a other path, like 'domain/notification' I change path "/" of proxy to "/notification", cuz a i have others apps, but i got a blank screen,.
ProxyPass /notification http://localhost:3000/
ProxyPassReverse /notification http://localhost:3000/
After search some hours, i change apache conf to
RewriteEngine On
RewriteCond %{HTTP_REFERER} ^https?://[^/]+/notification
RewriteCond %{REQUEST_URI} !^/notification
RewriteCond %{THE_REQUEST} ^GET
RewriteRule ^/(.*) /notification/$1 [QSA,R]
ProxyPass /notification http://localhost:8086/
ProxyPassReverse /notification http://localhost:8086/
ProxyPreserveHost On
but got Unable to connect to the Notica server. Attempting to reconnect...
Any idea?
I got! works
For register
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/socket.io [NC]
RewriteRule /(.*) http://localhost:3000/$1 [P,L]
RewriteCond %{HTTP_REFERER} ^https?://[^/]+/notification
RewriteCond %{REQUEST_URI} !^/notification
RewriteRule ^/(.*) /notification/$1 [QSA,R]
ProxyPass /notification http://localhost:3000
ProxyPassReverse /notification http://localhost:3000
ProxyPreserveHost On
U can closed this, thanks
Glad to hear it works! Enjoy!
I am not able to configure the apache reverse proxy, how can I configure it for Notica?