ChrisjV

Registered
Jul 6, 2017
4
0
1
Sydney
cPanel Access Level
Root Administrator
I’m currently running the latest version of Cpanel and receiving the following when connecting to a websocket with socket.io to a NodeJS server.


This appears in /usr/local/apache/logs/error_log


H01144: No protocol handler was valid for the URL /example.com/ (scheme 'wss'). If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule


This is indicating mod_proxy_wstunnel is not working correctly.


We have setup the proxy and proxyPass directives as well to ensure this is working:


#Proxy Stuff

RewriteEngine On

SSLProxyEngine On

ProxyRequests Off


ProxyPreserveHost On


ProxyPass /example.com/ wss://test.websitehere.com:3000/example.com/
ProxyPassReverse /example.com/ wss://test.websitehere.com:3000/example.com/


ProxyPass "/" "http://test.websitehere.com:3000/"
ProxyPassReverse "/" "http://test.websitehere.com:3000/"


It really feels like something is going on here with mod_proxy_wstunnel. If i’m corerct WHM/Cpanel uses easyapache to enable mod_proxy_wstunnel and that is on by default. Also it seems we cannot unload this module without it removing the MPM apache module as well.


Anyone have any ideas what is going on here?
 
Last edited by a moderator:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,254
463
Hello,

Could you open a support ticket using the link in my signature so we can take a closer look at your server's configuration?

Thank you.
 

siim

Registered
Nov 21, 2007
3
0
51
have the same issue. any solution to it? or I'd also have to open support ticket?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,254
463
Hello @siim,

Here's a quote from one of our Technical Analysts in the support ticket that was opened by the original poster (note that references to real domain names and usernames have been replaced with examples):

After some investigation, I found the following resource:

[Résolu] Apache 2.4 et ProxyPass Socket.IO (node.js) - Comment proxyfier uniquement du socket.io ? par Harmo801 - OpenClassrooms

I had to use Google Chrome to translate the page so that I could understand what was happening.

Upon reviewing the information there, I saw that this issue was resolved by adding an upgrade header.

I went ahead and took a shot at modifying this configuration to suite your situation, and it appears to have worked.

I added the following to your configuration:
=====================
# cat /etc/apache2/conf.d/userdata/ssl/2_4/username/domain.com/proxypass.conf
#Proxy Stuff
RewriteEngine On
SSLProxyEngine On
ProxyRequests Off

ProxyPreserveHost On

ProxyPreserveHost On

ProxyPass "/socket.io/" "ws://localhost:3000/socket.io/"
ProxyPassReverse "/socket.io/" "ws://localhost:3000/socket.io/"
ProxyPass "/" "http://localhost:3000/"
ProxyPassReverse "/" "http://localhost:3000/"

RewriteEngine on
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
RewriteRule .* ws://localhost:3000%{REQUEST_URI} [P]

#ProxyPass "/socket.io/" wss://domain.com:3000/socket.io/
#ProxyPassReverse "/socket.io/" wss://domain.com:3000/socket.io/

#ProxyPass "/" "http://domain.com:3000/superAdminPanel"
#ProxyPassReverse "/" "http://domain.com:3000/superAdminPanel"

=====================

This is in both files:
/etc/apache2/conf.d/userdata/ssl/2_4/username/domain.com/proxypass.conf
/etc/apache2/conf.d/userdata/std/2_4/username/domain.com/proxypass.conf

Now that the new configuration is in place I no longer see the error message when visiting the URL.

Please keep in mind that these types of configurations are not a part of the cPanel basic configuration.
The ticket submitter then sent a response with an additional note:

Thank you very much - it has been made aware that the upgrade did work. I had to remove the following:

ProxyPass "/socket.io/" "ws://localhost:3000/socket.io/"
ProxyPassReverse "/socket.io/" "ws://localhost:3000/socket.io/"

And that has allowed it operate now that the connection was upgraded.
Let me know if this information helps.

Thank you.
 

siim

Registered
Nov 21, 2007
3
0
51
helpful, not really.. still get the same error about invalid protocol handler.. so I just replaced wss:// part with http:// and from the first look of it, works fine..
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,254
463
helpful, not really.. still get the same error about invalid protocol handler.. so I just replaced wss:// part with http:// and from the first look of it, works fine..
I'm glad to see you were able to get it working. Do you mind confirming the full step-by-step instructions of how you solved the issue in-case anyone else encounters the same error?

Thanks!