The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Mod Rewrite and proxy for

Discussion in 'Workarounds and Optimization' started by Dennis Walsh, Jun 1, 2016.

  1. Dennis Walsh

    Dennis Walsh Registered

    Jun 1, 2016
    Likes Received:
    Trophy Points:
    Catalina Foothills, AZ
    cPanel Access Level:
    Root Administrator
    The question is how do you configure WHM Include Editor to mod rewrite virtual hosts?

    Specifically, I'm having the following issue...

    I'm running Node and servers behind WHM/Apache 2.4.2.

    The Node server works through a reverse proxy at port 80 by placing

    ProxyPass /backend http://localhost:8082
    ProxyPassReverse /backend http://localhost:8082

    in the Include Editor -> Post VirtualHost Include. piggybacks the Node server at localhost:8082/

    I have mod_proxy and mod_proxy_wstunnel installed via Easy Apache 4.

    However, when tries a web socket connection, the request 400s and reverts to long polling.

    I've tried placing
    RewriteEngine On
    RewriteCond %{REQUEST_URI} ^/ [NC]
    RewriteCond %{QUERY_STRING} transport=websocket [NC]
    RewriteRule /(.*) ws://localhost:8082/$1 [P,L]

    ProxyPass / http://localhost:8082/
    ProxyPassReverse / http://localhost:8082/

    into all three Include Editor locations to no avail. I've also tried Rewrite Inherit. (I've tried to just make it rewrite anything.. won't do it).

    Several others asked this question, but the response was always "put it in .htaccess." However, .htaccess does not accept ProxyPass.

    Any ideas?
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Apr 11, 2011
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator

    You may want to try editing the template for the VirtualHost per the document located at:

    Custom Templates - EasyApache - cPanel Documentation

    This will allow you to configure the entries within the VirtualHost instead editing the global Apache configuration. Keep in mind these custom modifications changes are unsupported

    Thank you.

Share This Page