Re: AW: [users@httpd] rewrite gurus help? (with mod_proxy_ajp)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Robert, I did as you said, and still it rewrote the URL in the address bar as if it were a redirect.

RewriteEngine on
RewriteRule ^/pub/wiv/(.*)\.asx$ /pub/wiv?seoName=$1 [QSA]
RewriteRule ^/pub/?(.*)      ajp://dev3:8009/pub/$1 [P]

I set up the rewriteLog, here are the pertainent lines:

(note that dev2 is the apache box, dev3 is the tomcat box)

10.1.10.82 - - [05/Jan/2006:14:03:32 --0700] [dev2/sid#9de9ac0][rid#9eaff98/initial] (2) init rewrite engine with requested uri /pub/wiv/Shop_Surf_00314_All_The_Rage.asx 10.1.10.82 - - [05/Jan/2006:14:03:32 --0700] [dev2/sid#9de9ac0][rid#9eaff98/initial] (3) applying pattern '^/pub/wiv/(.*)\.asx$' to uri '/pub/wiv/Shop_Surf_00314_All_The_Rage.asx' 10.1.10.82 - - [05/Jan/2006:14:03:32 --0700] [dev2/sid#9de9ac0][rid#9eaff98/initial] (2) rewrite '/pub/wiv/Shop_Surf_00314_All_The_Rage.asx' -> '/pub/wiv?seoName=Shop_Surf_00314_All_The_Rage' 10.1.10.82 - - [05/Jan/2006:14:03:32 --0700] [dev2/sid#9de9ac0][rid#9eaff98/initial] (3) split uri=/pub/wiv?seoName=Shop_Surf_00314_All_The_Rage -> uri=/pub/wiv, args=seoName=Shop_Surf_00314_All_The_Rage 10.1.10.82 - - [05/Jan/2006:14:03:32 --0700] [dev2/sid#9de9ac0][rid#9eaff98/initial] (3) applying pattern '^/pub/?(.*)' to uri '/pub/wiv' 10.1.10.82 - - [05/Jan/2006:14:03:32 --0700] [dev2/sid#9de9ac0][rid#9eaff98/initial] (2) rewrite '/pub/wiv' -> 'ajp://dev3:8009/pub/wiv' 10.1.10.82 - - [05/Jan/2006:14:03:32 --0700] [dev2/sid#9de9ac0][rid#9eaff98/initial] (2) forcing proxy-throughput with ajp://dev3:8009/pub/wiv 10.1.10.82 - - [05/Jan/2006:14:03:32 --0700] [dev2/sid#9de9ac0][rid#9eaff98/initial] (1) go-ahead with proxy request proxy:ajp://dev3:8009/pub/wiv [OK] 10.1.10.82 - - [05/Jan/2006:14:03:32 --0700] [dev2/sid#9de9ac0][rid#9eaff98/initial] (2) init rewrite engine with requested uri /pub/wiv/ 10.1.10.82 - - [05/Jan/2006:14:03:32 --0700] [dev2/sid#9de9ac0][rid#9eaff98/initial] (3) applying pattern '^/pub/wiv/(.*)\.asx$' to uri '/pub/wiv/' 10.1.10.82 - - [05/Jan/2006:14:03:32 --0700] [dev2/sid#9de9ac0][rid#9eaff98/initial] (3) applying pattern '^/pub/?(.*)' to uri '/pub/wiv/' 10.1.10.82 - - [05/Jan/2006:14:03:32 --0700] [dev2/sid#9de9ac0][rid#9eaff98/initial] (2) rewrite '/pub/wiv/' -> 'ajp://dev3:8009/pub/wiv/' 10.1.10.82 - - [05/Jan/2006:14:03:32 --0700] [dev2/sid#9de9ac0][rid#9eaff98/initial] (2) forcing proxy-throughput with ajp://dev3:8009/pub/wiv/ 10.1.10.82 - - [05/Jan/2006:14:03:32 --0700] [dev2/sid#9de9ac0][rid#9eaff98/initial] (1) go-ahead with proxy request proxy:ajp://dev3:8009/pub/wiv/ [OK]

I want the URL bar to read:
http://dev2/pub/wiv/Shop_Surf_00314_All_The_Rage.asx

But the GET in the access log to read:
/pub/wiv?seoName=Shop_Surf_00314_All_The_Rage

I am achieving the latter, but not the former.

I still cannot figure out why it rewrites the URL in the address bar from this debug code.






Robert Ionescu wrote:

Pete Lamborne wrote:

Gentlemen, thanks for revisiting this; I have not gotten it to work yet and still need to figure something out.

Oliver, your 1st suggestion resulted in the infinite loop again:

 RewriteEngine on
RewriteRule /pub/wiv/(.*).asx$ ajp://theTomcatBox:8009/pub/wiv?seoName=$1 [P,QSA,L]
 RewriteRule /pub                      ajp://theTomcatBox:8009/pub [P]

here is the error log.


it's the access log.

Note that the 3rd line is what I want it to do, and I don't know what starts the infinite loop from line 4 on down.

10.1.10.82 - - [05/Jan/2006:11:51:39 -0700] "GET /favicon.ico HTTP/1.1" 200 18014 10.1.10.82 - - [05/Jan/2006:11:51:39 -0700] "GET /pub/wiv/Shop_Surf_00314_All_The_Rage.asx HTTP/1.1" 302 - 10.1.10.82 - - [05/Jan/2006:11:51:39 -0700] "GET /pub/wiv/?seoName=Shop_Surf_00314_All_The_Rage HTTP/1.1" 302 - 10.1.10.82 - - [05/Jan/2006:11:51:39 -0700] "GET /pub/?seoName=Shop_Surf_00314_All_The_Rage HTTP/1.1" 302 -

[...]

The 2nd suggestion

 RewriteCond  %{QUERY_STRING}  "!^seoName"
 RewriteRule /pub/wiv/(.*).asx$ /pub/wiv?seoName=$1 [QSA,PT]
 RewriteRule /pub                      ajp://theTomcatBox:8009/pub [P]



The redirect comes from your application? Did you setup/check the rewriteLog? this is essential to debug rewriteRules.

RewriteEngine on
#RewriteCond  %{QUERY_STRING} !^seoName
RewriteRule ^/pub/wiv/(.*)\.asx$ /pub/wiv?seoName=$1 [QSA]
RewriteRule ^/pub/?(.*)      ajp://theTomcatBox:8009/pub/$1 [P]

You're using the rules in per-server context, right?

Note: with ajp://theTomcatBox:8009/pub you're only proxying to ajp://theTomcatBox:8009/pub even if you did call /pub/abc -- this is not the proxyPass directive. To proxy this request to ajp://theTomcatBox:8009/pub/abc, you'll have to modify the rule like above.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux