Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
litespeed_wiki:proxy:lsws-as-a-proxy-rewrite [2018/07/05 22:12] qtwrk [Use rewrite rules in .htaccess] |
litespeed_wiki:proxy:lsws-as-a-proxy-rewrite [2019/06/05 19:38] Lisa Clarke [Example 4: cpanel webmail like proxy] Copyediting |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== How to set up the server as a proxy via rewrite rules through .htaccess ====== | ====== How to set up the server as a proxy via rewrite rules through .htaccess ====== | ||
- | LiteSpeed works with Apache mod_proxy directives, but there is an extra step to add an external app of the proxy in LSWS configuration to make it work fully. | + | LiteSpeed doesn't support ''ProxyPass'', ''ProxyPassReverse'' and other mod_proxy directives(starting from LSWS 5.3.6, ''ProxyPass'' and-''ProxyPassMatch'' support for AJP backend have been added but not supported for non-AJP backend). However, you can use rewrite rules with ''[P]'' and set up an external app of the proxy in LSWS configuration to make it work fully. |
===== Add the remote proxy as an external app ===== | ===== Add the remote proxy as an external app ===== | ||
Line 55: | Line 55: | ||
RewriteRule ^(.*)$ https://127.0.0.1:5000/$1 [P,L] | RewriteRule ^(.*)$ https://127.0.0.1:5000/$1 [P,L] | ||
</code> | </code> | ||
+ | |||
+ | ==== Example 4: cPanel webmail-like proxy ==== | ||
+ | cPanel's ''www.domain.com/webmail'' proxy loads one installation at ''<nowiki>http://127.0.0.1/rainloop/</nowiki>''. | ||
+ | |||
+ | An Apache user without a control panel who wants to copy this behavior may achieve it with ''ProxyPass'', like so: | ||
+ | ProxyPass "/webmail/" "http://127.0.0.1/rainloop/" | ||
+ | |||
+ | But LiteSpeed doesn't support ''ProxyPass'' in this case. Instead, a LiteSpeed user may simply use the following rewrite rule in the virtual host's Apache configuration. No need to create an external app: | ||
+ | RewriteRule /webmail/(.*) http://127.0.0.1/rainloop/$1 [P] | ||
+ | |||
===== Testing ===== | ===== Testing ===== | ||
From the browser, | From the browser, |