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

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

 



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. 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 - 10.1.10.82 - - [05/Jan/2006:11:51:39 -0700] "GET /pub/?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 - 10.1.10.82 - - [05/Jan/2006:11:51:39 -0700] "GET /pub/?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 - 10.1.10.82 - - [05/Jan/2006:11:51:39 -0700] "GET /pub/?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 - 10.1.10.82 - - [05/Jan/2006:11:51:39 -0700] "GET /pub/?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 - 10.1.10.82 - - [05/Jan/2006:11:51:39 -0700] "GET /pub/?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 - 10.1.10.82 - - [05/Jan/2006:11:51:39 -0700] "GET /pub/?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 - 10.1.10.82 - - [05/Jan/2006:11:51:39 -0700] "GET /pub/?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 - 10.1.10.82 - - [05/Jan/2006:11:51:39 -0700] "GET /pub/?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 - 10.1.10.82 - - [05/Jan/2006:11:51:39 -0700] "GET /pub/?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]

Gave me an apache 404, it never dispatched to the tomcat box:

10.1.10.82 - - [05/Jan/2006:11:54:34 -0700] "GET /favicon.ico HTTP/1.1" 200 18014 10.1.10.82 - - [05/Jan/2006:11:54:34 -0700] "GET /pub/wiv/Shop_Surf_00314_All_The_Rage.asx HTTP/1.1" 404 205


As I've been saying, I've tried several configs that *should* work, and I think it's a logical problem in mod_proxy_ajp that is resulting in the infinite loop. But maybe you fellas can see something obvious from those logs?

Thanks,
pete




Oliver.Schaudt@xxxxxxxxx wrote:

Hi Pete,

Put an "L" inside the line with the "asx" -Line, so that  Apache knows this will be the "last " Rule.
Than with RewriteRules you don't need "ProxyPassReverse"

Than check these [ist is only inserted an ",L" before the "]":
 RewriteEngine on
 RewriteRule /pub/wiv/(.*).asx$ ajp://theTomcatBox:8009/pub/wiv?seoName=$1 [P,QSA,L]
 RewriteRule /pub                      ajp://theTomcatBox:8009/pub [P]

Another possibility will be to change the URI and than pass it with the next RewriteRule
(should be the same like the things above). Check it and tell me if it is working
 RewriteCond  %{QUERY_STRING}  "!^seoName"
 RewriteRule /pub/wiv/(.*).asx$ /pub/wiv?seoName=$1 [QSA,PT]
 RewriteRule /pub                      ajp://theTomcatBox:8009/pub [P]

At the momemt i use mod_jk to the back tomcat, but i will check this with mod_proxy_ajp as well.
Here i use it with a rewrite of the actual URI an this i transparent to the Clients Browser, They never see /b/ in their browsers
RewriteCond  %{REQUEST_URI}  "!^/abc/def"
RewriteRule  ^/abc/(.*)$     /abc/def/$1  [PT]
JkMount       /abc*              ajp13_tomcat

Ciao
Oliver

Von: Pete Lamborne [mailto:pete@xxxxxxxxxxx]
Gesendet: Mi 04.01.2006 17:53
An: users@xxxxxxxxxxxxxxxx
Betreff: Re: [users@httpd] rewrite gurus help? (with mod_proxy_ajp)



Yes, but as you could see from my code sample, there are no redirects. There is a proxypass preceded by a rewrite rule. That is why I feel
that the interaction between mod_proxy_ajp and mod_rewrite is buggy --
as far as I can tell, the behavior I'm getting is not due to an improper
configuration.

Is anyone else out there using apache 2.2 with mod_rewrite and
mod_proxy_ajp to pass to tomcat?  I'd really like to hear other people's
experience and see their config.




Rajendra Kadam -X (rakadam - eTouch Systems at Cisco) wrote:

Hi Pete,

You said that ..... "Rewrite goes into infinite loop" Is that correct ?

I also faced the same problem. And resolution that is when you are redirecting to some other url that particular url should not be in turn re-directed. Else it's infinite loop.

See this thread : http://mail-archives.apache.org/mod_mbox/httpd-users/200512.mbox/%3cF370ADC0040A424E8AB27D2BCEE35D0C013CC16E@xxxxxxxxxxxxxxxxxxxxxxxxxx%3e

It might help you.

Cheers,
Rajendra


-----Original Message-----
From: Pete Lamborne [mailto:pete@xxxxxxxxxxx]
Sent: Tuesday, January 03, 2006 10:10 AM
To: users@xxxxxxxxxxxxxxxx
Subject: Re: [users@httpd] rewrite gurus help? (with mod_proxy_ajp)

Yes I am using 2.2, for the advantages mod_proxy_ajp was supposed to have over mod_jk.  Now I am rethinking that decision...

I will use the logging for more insight, thanks for that tip as well.  I will post any info I find, and appreciate any other suggestions.
pete


Axel-Stéphane SMORGRAV wrote:



Another advantage of using RewriteRule over ProxyPass is that you get a lot better logging provided you set "RewriteLogLevel 3". That may help you understand why it loops...

I understood that you originally ended up with a redirect, but I thought that it might have been the application that was generating the redirect.

I take it you are using Apache 2.2 ?

-ascs

-----Original Message-----
From: Pete Lamborne [mailto:pete@xxxxxxxxxxx]
Sent: Tuesday, January 03, 2006 6:56 PM
To: users@xxxxxxxxxxxxxxxx
Subject: Re: [users@httpd] rewrite gurus help? (with mod_proxy_ajp)

ASCS, thanks for your reply.

Your suggestion (and several permutations of it) were not successful; I don't quite understand why, but it created an infinite loop.

I don't think the original situation (where it *works*, but the URL is rewritten in the user's browser) is due to ProxyPass being evaluated first, because the URL did indeed get rewritten 1st (it's just that it wasn't transparent to the user).

I believe this is more likely to be a bug in the way the mod_proxy_ajp and mod_rewrite interact, rather than a matter of configuration.

But I really appreciate more suggestions and/or workarounds!
Thanks, pete


Axel-Stéphane SMORGRAV wrote:



Could it possibly be because ProxyPass is evaluated before RewriteRule ?

How does the following work :

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

-ascs

-----Original Message-----
From: Pete Lamborne [mailto:pete@xxxxxxxxxxx]
Sent: Monday, January 02, 2006 6:48 PM
To: users@xxxxxxxxxxxxxxxx
Subject: [users@httpd] rewrite gurus help? (with mod_proxy_ajp)

Hey all,
There is very little info out there on this so far, given how new
mod_proxy_ajp is.  One post I found seemed to indicate the same bug
with no solution....

The problem is that I can't get mod_rewrite to work transparently with
mod_proxy_ajp.  It either doesn't work at all (when I don't specify
:proxy or [P]), or works like a redirect, changing the URL in the
user's browser.

Here's a quick conf:

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

Here's something else I tried with the same results:

RewriteEngine on
RewriteRule /pub/wiv/(.*).asx$ proxy:ajp://dev3:8009/pub/wiv?seoName=$1
ProxyPass /pub ajp://theTomcatBox:8009/pub ProxyPassReverse /pub
ajp://theTomcatBox:8009/pub

Both of these solutions work, but replace the pretty URL with the ugly
one for the end-user.  I want it to be transparent to the user.

What am I missing?



---------------------------------------------------------------------
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


---------------------------------------------------------------------
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






---------------------------------------------------------------------
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


---------------------------------------------------------------------
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




---------------------------------------------------------------------
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

---------------------------------------------------------------------
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





---------------------------------------------------------------------
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



------------------------------------------------------------------------

---------------------------------------------------------------------
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


---------------------------------------------------------------------
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