...
You will need to enable proxy_wstunnel and modify the OMK provided Apache virtual host.
The minimum Apache version required is 2.4.5
Debian
If you are running a debian based linux os please enable these apache modules
Code Block |
---|
a2enmod proxy a2enmod proxy_http a2enmod proxy_wstunnel |
CentOS & Redhat 7
Edit /etc/httpd/conf.modules.d/00-proxy.conf
...
Code Block |
---|
ProxyPass "/en/omk/opEvents/ws/events" ws://localhost:8042/en/omk/opEvents/ws/events |
Proxy the websocket for Redhat 7
This has been tested with Apache 2.4.6
Instead of ProxyPass you will need to use ProxyPassMatch
Code Block |
---|
ProxyPassMatch ^/(en/omk/opEvents/ws/events)$ ws://localhost:8042/$1 |
A basic example with config to use serve opEvents over SSL and proxy the Webscockets
Code Block |
---|
<VirtualHost *:443> ServerName example.opmantek.com SSLEngine on SSLProxyEngine On ProxyRequests Off SSLCertificateFile /etc/ssl/certs/example/cert.pem SSLCertificateKeyFile /etc/ssl/certs/example/privkey.pem SSLCertificateChainFile /etc/ssl/certs/example/fullchain.pem RequestHeader set X-Forwarded-Proto "https" # Proxy the websocket connection ProxyPassMatch ^/(en/omk/opEvents/ws/events)$ ws://localhost:8042/$1 # Proxy the rest of the application ProxyPass / http://localhost:8042/ ProxyPassReverse / http://localhost:8042/ </VirtualHost> |
Debugging Web Socket connections
If you see this error it means the browser cannot connect to the webserver, at this current point you will need to use the Browsers developments tools to access the Javascript Console
Uncaught DomException: The operation is insecure
You are serving opEvents over ssl but the websocket is trying to to connect over http, this is disallowed from happening because of browser security policies.
You will need to find your Apache Config and make sure this header is being sent to the omkd web server
Code Block |
---|
RequestHeader set X-Forwarded-Proto "https" |
Get /en/omk/opEvents/ws/events 404 Not Found
The websocket is trying to connect securely but its not being proxied correctly, please see the above section Proxy the webscocket
Check Apache has proxy_wstunnel_module loaded
Code Block |
---|
httpd -t -D DUMP_MODULES | grep proxy_wstunnel_module |
(shared)Current Issues
Event partial updates over websockets eg {id:abc, acknowledged:1} have no group check, meaning if you have a user with only group access of "DataCenter" their browsers websocket would receive partial updates from events their group permission would not allow access to. As the users browsers doesn't have the original event the partial update will not be shown to the user. This is planned to be fixed in the next release.
...