Hello!
We are trying to fight this problem for a day hunting Google for solutions, but unfortunately nothing seem to work. What we are simply trying to achieve:
1. Proxy traffic from `/.*` to reverse proxy ONLY if User-Agent matches
2. Proxed traffic has to go to a https backend
3. URL has to be rewritten, so when user visits
4. Every request to a backend has to be authenticated with custom token header
We were able get either #3+1 (using Apache rewrite) OR #4 (using context) but not all with lsws. Configuring this with Apache is as easy as:
How to achieve something like that in LiteSpeed Web Server?
**Edit:**
After studying OpenLSWS code I found a workaround which seem to work, but I'm afraid I may be breaking something else.
1. Set rewrite rule:
2. Setup External App with
3. Setup context w/type=Proxy with URL
It seems like LSWS will evaluate rewrite and then jump to search for context, which matches for proxing.
--
Greg
We are trying to fight this problem for a day hunting Google for solutions, but unfortunately nothing seem to work. What we are simply trying to achieve:
1. Proxy traffic from `/.*` to reverse proxy ONLY if User-Agent matches
2. Proxed traffic has to go to a https backend
3. URL has to be rewritten, so when user visits
https://example.com/foo/bar
the backend request will be https://backend/https://example.com/foo/bar
4. Every request to a backend has to be authenticated with custom token header
We were able get either #3+1 (using Apache rewrite) OR #4 (using context) but not all with lsws. Configuring this with Apache is as easy as:
Apache config:
RequestHeader set X-Auth-Token "...."
RewriteCond %{HTTP_USER_AGENT} magic_ua [NC,OR]
RewriteRule (.*) http://backend/http://example.com/$1 [P,L]
How to achieve something like that in LiteSpeed Web Server?
**Edit:**
After studying OpenLSWS code I found a workaround which seem to work, but I'm afraid I may be breaking something else.
1. Set rewrite rule:
Apache config:
RewriteRule /https?: - [F]
RewriteCond %{HTTP_USER_AGENT} magic_ua [NC,OR]
RewriteRule (.*) /http://example.com/$1 [L]
URL=http://backend:1234
and RequestHeader Set X-Auth-Token
3. Setup context w/type=Proxy with URL
exp:/https?:.*
pointing to External App from #2It seems like LSWS will evaluate rewrite and then jump to search for context, which matches for proxing.
--
Greg
Last edited by a moderator: