Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set up mod_proxy_wstunnel on Apache 2.2 on CentOS

Is there a way to set up the mod_proxy_wstunnel module on Apache 2.2 on CentOS? I can't upgrade to 2.4 due to project limitations.

like image 272
user2825505 Avatar asked Feb 13 '23 11:02

user2825505


1 Answers

I have invested lot of time figuring this out and there is very little documentation available for this. Let me know if this helps, else I can help you troubleshooting the problem. Also hope this helps to future readers.

To compile mod_proxy_wstunnel.so,

  1. yum install httpd-devel
  2. Download the mod_proxy_wstunnel.c
  3. Compile it using, apxs -i -a -c mod_proxy_wstunnel.c

Now load the above compiled module in /etc/httpd/modules

  1. Copy the mod_proxy_wstunnel.so in /etc/httpd/modules (Compiled from above)

  2. In order to load the module while the server starts, use LoadModule directive in the httpd conf file, /etc/httpd/conf/httpd.conf

Add the following line with all other LoadModule line,

LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
  1. To restart apache, use service httpd restart

  2. To check the loaded modules in apache after restarting use, httpd -M

  3. After the module is installed, Add this two lines in /etc/httpd/conf/httpd.conf

ProxyPass /websockets/mywebsocket ws://mywebsocketserver.com//websockets/mywebsocket retry=4  
ProxyPassReverse /websockets/mywebsocket ws://mywebsocketserver.com//websockets/mywebsocket retry=4

Note: Make sure the above lines are added before the default case of /. Also restart apache just to be safe.

like image 174
LearningAboutTech Avatar answered Mar 06 '23 19:03

LearningAboutTech