Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite with proxy pass

         

oswald_yang

8:47 am on Apr 20, 2010 (gmt 0)

10+ Year Member



Hey guys,

We recently started serving dynamic sites from the Oracle cache (mod_plsql) and the average URL looks something like this:

http://www.nqf.org.za/pls/cms/page?s=3260,0,0,0,177,0,Home


And we're trying to make use this and redirect to the above:

http://www.nqf.org.za/3261/0/0/0/177/0/Home


The rule I'm using:

RewriteRule ^/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)/(.*)$ /pls/cms/page?s=$1,$2,$3,$4,$5,$6,$7


Should be working fine (and do according the to mod_rewrite logs, but is failing with Apache error "Not Found - The requested URL /3261/0/0/0/177/0/Home was not found on this server." it seems the /pls/ is screwing me over since it on other port (see below) and doesn't exist in the physical path /web/nqf/html

ProxyPass /pls/ http:// localhost:7777/pls/
ProxyPassReverse /pls/ http:// localhost:7777/pls/


So that's my problem. I looked into both the [P] and [TP] flags but to no avail. If anyone can assist with this it would be much appreciated.

NOTE: I added spaces between http:// localhost... in the ProxyPass URL's as the preview converted them into links, there's no spaces in the vhost.

Thanks and cheers,
Charl

[edited by: jdMorgan at 1:49 pm (utc) on Apr 20, 2010]
[edit reason] Snipped URL -- Please see TOS. [/edit]

oswald_yang

11:57 am on Apr 20, 2010 (gmt 0)

10+ Year Member



Hey All,

Just to let you know I managed to crack it using the Force Proxy flag [P]. This is what I changed the Rewrite Rule to:

RewriteRule ^/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)/(.*)$ http:// localhost:7777/pls/cms/page?s=$1,$2,$3,$4,$5,$6,$7 [P]


Note: Once again the space between http:// and localhost should not be there.

Cheers,
Charl

jdMorgan

1:54 pm on Apr 20, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for posting your solution. Here, it appears that a direct proxy through-put to the back-end was needed - otherwise, the hostname prepended to your rewritten path using the [P] flag would have been whatever ServerName was declared for the server running this code.

Interesting, though, that [PT] did not work, as this should have passed the rewritten path back to mod_proxy... Perhaps some anomaly in Apache module execution order(?)

Jim