httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Weber <mwe...@csksoftware.com>
Subject Re: Apache 1.3.22 gives 302 on mod_rewrite
Date Tue, 27 Nov 2001 19:23:24 GMT
Hello,

> 
> I haven't looked at the logs you posted, but the configuration you sent
> did not look anything like either of the two options listed in the FAQ.
> If you are going to use the RewriteRule version you will absolutely need a
> RewriteCond on the HTTP_HOST to prevent looping.  It will never work
> otherwise.

it was a good idea with the looping. I tried a rule that will loop, just
to see what it looks like in the browser & logs.

The rule I tried is 

RewriteRule ^(.*)  http://server.ourdomain.com:81/$1      [R]

and that one loops for sure. It recursively adds slashes to the request,
so the log ends up with something like


192.168.130.10 - - [27/Nov/2001:18:57:20 +0100]
[server.ourdomain.com/sid#f22e0][rid#11cfe8/initial] (2) rewrite
///////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////index.html
-> http://server.ourdomain.com:81///////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////index.html

...it seems not even to break at a length of 255.

The following I'm not completely sure of, so please s.o. correct me, if
I'm wrong:

The example in the faq is ^/(.*), which would loop too, if it wasn't
caught somewhere. That's what Joshua pointed out, and I agree
completely. Since I removed the conditions mentioned in the faq and 

RewriteRule ^/(.*)  http://server.ourdomain.com:81/$1      [R,L]

invoked with http://server:81/ gives in the rewrite log

192.168.130.10 - - [27/Nov/2001:20:00:57 +0100]
[server.ourdomain.com/sid#f22e0][rid#11cfe8/initial] (2) init rewrite
engine with requested uri /index.html
192.168.130.10 - - [27/Nov/2001:20:00:57 +0100]
[server.ourdomain.com/sid#f22e0][rid#11cfe8/initial] (3) applying
pattern '^/(.+)' to uri '/index.html'
192.168.130.10 - - [27/Nov/2001:20:00:57 +0100]
[server.ourdomain.com/sid#f22e0][rid#11cfe8/initial] (2) rewrite
/index.html -> http://server.ourdomain.com:81/index.html
192.168.130.10 - - [27/Nov/2001:20:00:57 +0100]
[server.ourdomain.com/sid#f22e0][rid#11cfe8/initial] (2) explicitly
forcing redirect with http://server.ourdomain.com:81/index.html
192.168.130.10 - - [27/Nov/2001:20:00:57 +0100]
[server.ourdomain.com/sid#f22e0][rid#11cfe8/initial] (1) escaping
http://server.ourdomain.com:81/index.html for redirect
192.168.130.10 - - [27/Nov/2001:20:00:57 +0100]
[server.ourdomain.com/sid#f22e0][rid#11cfe8/initial] (1) redirect to
http://server.ourdomain.com:81/index.html [REDIRECT/302]

which doesn't look like a loop for me, couldn't it be that the "L"
catches? Kind of remembering state? I'm just guessing here, really...

> 
> Why don't you start again with one of the options in the FAQ and let us
> know what problems you find if any.
> 

I *started* from there. I got the result I described. I checked,
double-checked & re-checked to make sure I'm correct with the regex and
the server-names. Same result. Then I started to remove conditions. Same
result. I started over from the beginning, same result. I said "I read
the faq" because I *did* read the faq, the mod_rewrite Rewriting Guide
and Ralf Engelschalls Rewriting Guide and not because it's the most
convenient thing to say.

This isn't even the first time I set up Apache with mod_rewrite, and I
never had any problems with it.

Are there known issues with Netscape failing redirection? I know IE does
behave strange in this respect sometimes, but I don't remember about
Netscape...

Well, thanks for all the help so far...

Marc

Mime
View raw message