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

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > Install/Configuration > what goes first urlrewrite or context

Reply
 
Thread Tools Display Modes
  #1  
Old 04-01-2013, 10:58 PM
gdewey gdewey is offline
Member
 
Join Date: Mar 2013
Posts: 38
Default what goes first urlrewrite or context

when a request hits lswd what fires first the REWRITE RULES or a possible PROXY CONTEXT?

I need a proxy context that hits

www.domain.com/directory but TARGETS the proxy IP with out the directory name that was in the context URI.

I assume that my rewrite rule should be something like:


RewriteRule ^vanguardia/(.*)$ http://192.168.120.120/$1 [R=301,L]

where my VH is
http://192.168.120.120/vanguardia

but needs to target the webserver destiny with out the directory

any ideas on whats wrong?

tks
Reply With Quote
  #2  
Old 04-02-2013, 01:07 AM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,218
not very clear about your request.
Quote:
but needs to target the webserver destiny with out the directory
what does it mean ?
Reply With Quote
  #3  
Old 04-02-2013, 08:15 AM
gdewey gdewey is offline
Member
 
Join Date: Mar 2013
Posts: 38
ok let me put it in other way

VH IP: 192.168.120.120
Context /vanguardia/ (type proxy)

WebServer external app: 50.22.195.205:80

If I hit http://192.168.120.120/vanguardia

it will proxy the request to: http://50.22.195.205:80/vanguardia

my goal is to proxy the request EXCLUDING the context of the VH so it would just proxy to "http://50.22.195.205:80" with out the context directory.

I am confuse on how the effect is on the rewriterule engine vs the target webserver.

I've tried for hours using the P flag and many Regex.

any ideas on how to acomplish?

is there a variable for the ReWrite to match the target webserver? or is there a way to rewrite the target webserver external app?

tks
Reply With Quote
  #4  
Old 04-02-2013, 08:30 AM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,218
now almost clear, thanks for clarification.

you can use rewriterule on virtual host(not .htaccess), and don't define any context. i.e., use virtual host level rewriterule to control all.

as before, define a web server external app:
name:test-proxy
address:50.22.195.205:80

the rewriterule in virtual host:
RewriteRule /vanguardia/(.*) http://test-proxy/$1 [P]

this should work as you expect.
Reply With Quote
  #5  
Old 04-02-2013, 04:00 PM
gdewey gdewey is offline
Member
 
Join Date: Mar 2013
Posts: 38
that very interesting the reason I was using the context is because I needed cache, but I assume I could also call the cache functionality using the same rewrite engine and that will overwrite the context right?

so, correct me if I am right.. in order of importance there is

SERVER
VH
CONTEXT
REWRITE

where from bottom to top it will overwrite one another.

I am trying to use regex magic product to make some advance matches but it asks me for the type of regex engine.. rewrite module uses the perl flavor?, it has like 8 types :S

I assume its the perl.
Reply With Quote
  #6  
Old 04-02-2013, 07:02 PM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,218
not sure, but apache compatible, so look up apache document may get the answer.

to enable cache:
RewriteRule /vanguardia/(.*) http://test-proxy/$1 [P, E=Cache-Control:max-age=60]

I recommend you focus on vhost rewriterule only in your case. don't use .htaccess and context for less confusion and better performance.
Reply With Quote
Reply

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 05:54 AM.



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