SOLVED Reverse proxy with litespeed

Operating System & Version
CloudLinux v8.8.0
cPanel & WHM Version
114.0.6

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
17,470
2,843
363
cPanel Access Level
Root Administrator

Festuc

Member
Jul 26, 2021
8
0
1
Spain
cPanel Access Level
Root Administrator
Thanks for the reply. This doc is for litespeed versions before 6.0 that dit not support ProxyPass.

I tried the old but didn't work since I need to do them via ProxyPass because external server (backend) is via URL and not IP.
 

Festuc

Member
Jul 26, 2021
8
0
1
Spain
cPanel Access Level
Root Administrator
Thanks worked great, adapting the last tutorial.

mkdir -p /etc/apache2/conf.d/userdata/std/2_4/USER/domain.com/
mkdir -p /etc/apache2/conf.d/userdata/ssl/2_4/USER/domain.com/

nano /etc/apache2/conf.d/userdata/std/2_4/USER/domain.com/proxy.conf
nano /etc/apache2/conf.d/userdata/ssl/2_4/USER/domain.com/proxy.conf

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule (.*) http://external-domain.com:80/$1 [P,L]
ProxyPass / http://external-domain.com/
ProxyPassReverse / http://external-domain.com/
</IfModule>

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule (.*) https://external-domain.com:443/$1 [P,L]
ProxyPass / https://external-domain.com/
ProxyPassReverse / https://external-domain.com/
</IfModule>

Rebuild the Apache configuration file, and restart LSWS:

/scripts/buildhttpdconf

/usr/local/lsws/bin/lswsctrl restart