rewrite proxy not working as expected

#1
Hi

I used to use Apache rewrite rules in a .htaccess to act as a proxy when I used Apache on cPanel, I've now since switched to Litespeed and am trying to use the same .htaccess rules however they're not working like they used to on Apache.

I have the following in my .htaccess of domain1.com:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^api/(.*) http://domain2.com/api/$1 [P]
</IfModule>

When I access domain1.com/api/test, I seem to go into some sort of loop and my requests eventually show up in the access log of domain1.com but the content from domain2.com never gets retrieved - its access log shows no attempts.

My goal is to access domain1.com/api/test and for this to proxy the request to domain2.com/api/test

I've already read through https://docs.litespeedtech.com/cp/cpanel/rewrite-proxy/ but sadly hasn't helped me find a working solution.

P.S. how do I use mod_proxy since the above litespeed docs say it's supported since v6.0? I cannot find any documentation in litespeed's docs for this.

Thanks
 

Pong

Administrator
Staff member
#2
You should create external app for domain2.com. The doc should already explain and show you about that part.
 
#3
You should create external app for domain2.com. The doc should already explain and show you about that part.
You're right, it does, but it says "As of v6.0, LiteSpeed Web Server supports ProxyPass natively. It is no longer required to set up an external app. ", does this not extend to the rewrite rule I'm trying to use?
 
Top