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

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > Install/Configuration > Rewrite before reverse proxy?

Reply
 
Thread Tools Display Modes
  #1  
Old 01-18-2006, 12:02 PM
jburks725 jburks725 is offline
New Member
 
Join Date: Oct 2005
Posts: 6
Default Rewrite before reverse proxy?

I'm using LSWS 2.1.9 and love it. You've got a great product, please keep up the good work.

In my experimentation with Ruby and Rails, I've decided I want to use SCGI clustering to run my Rails app and have LSWS set up as a reverse proxy for lighttpd. This works quite well and I'm able to access everything as expected simply by setting up the lighttpd in the vhost External Apps section and creating a context of '/' that proxies to it.

However, I'd like to do some URL re-writing before my Rails app (Typo) gets the request (I'm migrating from a different blogging package with a different, but similar enough to use rewriting, pretty-URL scheme). However, turning on re-writing at the vhost level doesn't seem to pass the re-written URL on through the reverse proxy. I have logging turned up and I know that my rewrite rules are generating the URL I want, but it doesn't seem to ever give that new URL to my '/' proxy context.

Any pointers on how I'd accomplish this? I know Apache rewrite rules much better than lighttpd's scheme and so would like to do them in LSWS before the lighttpd server even sees them.

Here is exactly what I'm trying to do:

Rewrite Rules (at vhost level):
RewriteCond %{REQUEST_URI} ^\/archives\/\d{4}/.+\.html
RewriteRule ^\/archives\/(\d{4})/(.+)\.html \/articles\/$1\/99\/01\/$2 [QSA]

Log output is:
2006-01-18 14:49:27.755 [INFO] [72.224.120.167:44429-0#typo] [REWRITE] Cond: Match '/archives/2005/i-feel-like-im-floating.html' with pattern '^\/archives\/\d{4}/.+\.html', result: 1
2006-01-18 14:49:27.755 [INFO] [72.224.120.167:44429-0#typo] [REWRITE] Source URI: '/archives/2005/i-feel-like-im-floating.html' => Result URI: '/articles/2005/99/01/i-feel-like-im-floating'

Looking at my logs in Rails, it appears that the URI is getting passed to the proxy first, and then when the proxy is returning a 404, LSWS is rewriting it to the URI I want. Can this order be reversed so the rewrite happens first? If I visit the Result URI manually (by typing it into the address bar so that it doesn't get rewritten), it gives me the resulting page that I want. But how do I get this to work using the rewrite engine?

Thanks for your help and for your great product.

-Jason
Reply With Quote
  #2  
Old 01-18-2006, 12:17 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,585
Thank you for your praise.

Unfortunately, our current reverse proxy interface just pass the original request though, the rewritten URL cannot be applied to it yet.

Instead of using lighttpd with SCGI, maybe you can try Rails on LSWS via FCGI interface on the backend, just make sure to turn off the persistent connection in the FCGI configuration, as Ruby's FCGI interface does not support persistent connection yet. Just a recommendation. :-)
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
changing content-type on reverse proxy Brandon Install/Configuration 2 04-18-2007 08:55 PM
can i set up reverse proxy using apache with webdav? slamp Apache Migration/Compatibility 3 03-06-2006 04:38 PM
Help setting up reverse proxy virtual host joe Install/Configuration 4 11-23-2005 12:33 PM
Protecting Reverse Proxy URL with Password dorijan Install/Configuration 1 08-08-2005 09:50 AM
rewrite content limit Channel_Cat Bug Reports 1 09-21-2004 03:37 PM


All times are GMT -7. The time now is 01:37 AM.



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