LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > Install/Configuration > Host replace for proxy configuration

Reply
 
Thread Tools Display Modes
  #11  
Old 03-20-2013, 06:32 PM
gdewey gdewey is offline
Member
 
Join Date: Mar 2013
Posts: 38
Its a trial I downloaded 2 days ago. Version 4.2.2 Ent for 2 CPU Expiration Apr 02, 2013

gdewey@ubuntu:/etc/network$ ls -lt /usr/local/lsws/bin/lshttpd*;date;date -u
lrwxrwxrwx 1 root root 15 Mar 18 22:33 /usr/local/lsws/bin/lshttpd -> ./lshttpd.4.2.2
-r-xr-xr-x 1 root root 11956833 Mar 18 22:33 /usr/local/lsws/bin/lshttpd.4.2.2
Wed Mar 20 19:30:17 CST 2013
Thu Mar 21 01:30:17 UTC 2013

one question.. the rewrite/proxy does change the links to the front end VH right? (regardless I might be having a bad config or something)..
Reply With Quote
  #12  
Old 03-20-2013, 07:31 PM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,218
the rewrite/proxy has been working for long, and I've done many tests on this function in the past. I'd share more experience after you've got it working, for example, how to get it working with cache in rewriterule.

please check if you've defined proxy context at the same time.
if so, best to delete them to reduce conflict. forgot to ask, if the virtual host defined in lsws admin console(i.e., native vhost) or come from apache's httpd.conf ?
Reply With Quote
  #13  
Old 03-20-2013, 08:42 PM
gdewey gdewey is offline
Member
 
Join Date: Mar 2013
Posts: 38
Quote:
Originally Posted by NiteWave View Post
the rewrite/proxy has been working for long, and I've done many tests on this function in the past. I'd share more experience after you've got it working, for example, how to get it working with cache in rewriterule.

please check if you've defined proxy context at the same time.
if so, best to delete them to reduce conflict. forgot to ask, if the virtual host defined in lsws admin console(i.e., native vhost) or come from apache's httpd.conf ?
Hi Nite, if I defined the context at the same time as what? or where else?

Virtual Host was created in the admin console. Does not come from apache.
Reply With Quote
  #14  
Old 03-20-2013, 09:25 PM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,218
for example in your case, if you define a proxy context which URI is /, then your all your rewriterules should be useless, whether they are parsed or not.

enable debug log and rewrite log, you can see the details how there rules are processed and what's the final result.

debug log:
admin console->Actions->Toggle Debug Logging

rewrite log:
select a vhost->Rewrite->Enable Rewrite:Yes; Log Level:9
Reply With Quote
  #15  
Old 03-20-2013, 09:29 PM
gdewey gdewey is offline
Member
 
Join Date: Mar 2013
Posts: 38
yes that is my case. proxy context is / .. so how do I set rewrite rules for this type of context so they apply to it?

let me enable the logs to tail them while testing
Reply With Quote
  #16  
Old 03-20-2013, 09:33 PM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,218
Quote:
how do I set rewrite rules for this type of context
this rewriterule do same as proxy / context:
RewriteRule (.*) http://VanguardiaWeb/$1 [P]

but don't use them at the same time. use either one.
Reply With Quote
  #17  
Old 03-20-2013, 09:44 PM
gdewey gdewey is offline
Member
 
Join Date: Mar 2013
Posts: 38
ok understood. I took the rule out and tested also disabled the rewrite engine but no luck. still the backend site gives links as original.

there is one thing that I belive it might be affecting

the proxy is calling the back end server with an ip..

but the backend server has a rewriter that sets a hostname ..

would it be possible that the match of the rewrite is not being done because the lsws belives the match is the ip and not the rewriten host on the backend?
Reply With Quote
  #18  
Old 03-20-2013, 10:07 PM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,218

please refer:
https://store.litespeedtech.com/stor...yarticle&id=21
about "Proxy-Host"

for your case:
RewriteRule (.*) http://VanguardiaWeb/$1 [P,E=Proxy-Host:www.example.com]

however, if frontend and backend server's domain name are same, you don't need set Proxy-Host.

Last edited by NiteWave; 03-20-2013 at 10:09 PM..
Reply With Quote
  #19  
Old 03-20-2013, 10:09 PM
gdewey gdewey is offline
Member
 
Join Date: Mar 2013
Posts: 38
this one fits perfect
RewriteRule ^(.*)$ http://node1/$1 [P,E=Proxy-Host:www.example.com]

from what I understand I can set a custom host regardless the target server host.

The problem is that I am on the / context and cannot use ReWrite rules as you mention.. I tried that rule before but didn't took any effect

any ideas to keep the / context and still be able to set rewrite rules?
Reply With Quote
  #20  
Old 03-20-2013, 10:20 PM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,218
I encountered exact same issue as you before ... you can keep other context like /abc/ at the same time but can't keep context / since it matchs everything.

and in rewriterule you can do almost everything which a contect can, and, in context, no such "Proxy-Host" function yet, so any special requirement which must use context ?
Reply With Quote
Reply

Tags
proxy rewrite

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 10:12 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.