CentOS 8
Sponsored Link

Apache httpd : Configure mod_proxy_wstunnel2020/01/10

 
Enable [mod_proxy_wstunnel] module to configure WebSocket Proxy.
[1]
[2]
[3] Configure Apache httpd.
For example, Configure httpd to set proxy on [/chat] for the application which listens on localhost:1337.
# module are enabled by default

[root@www ~]#
grep "wstunnel" /etc/httpd/conf.modules.d/00-proxy.conf

LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so

[root@www ~]#
vi /etc/httpd/conf.d/wstunnel.conf
# create new

ProxyRequests Off
SSLProxyEngine on
<Proxy *>
    Require all granted
</Proxy>

ProxyPass /socket.io/ https://www.srv.world:1337/socket.io/
ProxyPassReverse /socket.io/ https://www.srv.world:1337/socket.io/

ProxyPass /chat https://www.srv.world:1337/
ProxyPassReverse /chat https://www.srv.world:1337/

[root@www ~]#
systemctl restart httpd

[4] If SELinux is enabled, change policy.
The port below is the one sample application listens.
[root@www ~]#
setsebool -P httpd_can_network_connect on

[root@www ~]#
semanage port -a -t http_port_t -p tcp 1337

[5] Access to the sample application to make sure it works normally on proxy environment.
Matched Content