Yet Another mod_rewrite SSL Question...

Yet Another mod_rewrite SSL Question...

am 04.12.2007 15:15:51 von Davertron

Hey Guys,
I'm having an interesting issue with redirecting http traffic to https
using mod_rewrite. First, I'll explain my setup a little bit. I'm
running Apache 2.0.52 on Redhat. I basically have something that
looks like this:

Listen 80
Listen x.x.x.x:443

NameVirtualHost *:80
NameVirtualHost *:443


RewriteLog "/tmp/rewrite.log"
RewriteLogLevel 9

RewriteEngine on
RewriteCond %{REQUEST_URI} ^/admin [NC]
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [NC,R,L]



(SSL Setup, etc.)


So, the idea is that if the user tries to go to the /admin part of the
site, the request is redirected to SSL. This works correctly!
However, if the user tries to go to /admin/does_not_exist, I would
expect them to get redirected to https, and then for them to get a
404. That is what I want to happen. However, what actually happens
is this:

* The http connection matches the RewriteCond for ^/admin, and so
is redirected to https (GOOD!)
* The https connection is then checked against the RewriteCond for
^/admin, which it matches, and so it is redirected to https again
(HUH?)
* Rinse, repeat, indefinitely

I know this because I've enabled the RewriteLog and I can see it
happening in there. If I remove the RewriteRule from my insecure
vhost, the indefinite redirect on a file that does not exist goes away
and I get a 404 as I would expect, so I know the issue is with this
rewrite. So my question is basically this: why, after the connection
is redirected to https, do the RewriteRules in the insecure vhost get
checked at all? If I understand correctly those should never be run
because the https connection is on port 443. Am I missing something
here? I found this article (http://www.onlamp.com/pub/a/apache/
2004/01/29/apache_ckbk.html) which describes the possibility of
looping if your redirect is not in the correct place in your config,
however I believe that in this case my setup matches the way they
describe.

I'm happy to post more info if someone needs it, and thanks in advance
for taking the time to read this far :)

Re: Yet Another mod_rewrite SSL Question...

am 04.12.2007 17:17:18 von Davertron

On Dec 4, 9:15 am, Davertron wrote:
> Hey Guys,
> I'm having an interesting issue with redirecting http traffic to https
> using mod_rewrite. First, I'll explain my setup a little bit. I'm
> running Apache 2.0.52 on Redhat. I basically have something that
> looks like this:
>
> Listen 80
> Listen x.x.x.x:443
>
> NameVirtualHost *:80
> NameVirtualHost *:443
>
>
> RewriteLog "/tmp/rewrite.log"
> RewriteLogLevel 9
>
> RewriteEngine on
> RewriteCond %{REQUEST_URI} ^/admin [NC]
> RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [NC,R,L]
>

>
>
> (SSL Setup, etc.)
>

>
> So, the idea is that if the user tries to go to the /admin part of the
> site, the request is redirected to SSL. This works correctly!
> However, if the user tries to go to /admin/does_not_exist, I would
> expect them to get redirected to https, and then for them to get a
> 404. That is what I want to happen. However, what actually happens
> is this:
>
> * The http connection matches the RewriteCond for ^/admin, and so
> is redirected to https (GOOD!)
> * The https connection is then checked against the RewriteCond for
> ^/admin, which it matches, and so it is redirected to https again
> (HUH?)
> * Rinse, repeat, indefinitely
>
> I know this because I've enabled the RewriteLog and I can see it
> happening in there. If I remove the RewriteRule from my insecure
> vhost, the indefinite redirect on a file that does not exist goes away
> and I get a 404 as I would expect, so I know the issue is with this
> rewrite. So my question is basically this: why, after the connection
> is redirected to https, do the RewriteRules in the insecure vhost get
> checked at all? If I understand correctly those should never be run
> because the https connection is on port 443. Am I missing something
> here? I found this article (http://www.onlamp.com/pub/a/apache/
> 2004/01/29/apache_ckbk.html) which describes the possibility of
> looping if your redirect is not in the correct place in your config,
> however I believe that in this case my setup matches the way they
> describe.
>
> I'm happy to post more info if someone needs it, and thanks in advance
> for taking the time to read this far :)

Hey, me again, not sure if this will help, but here's the output to
the RewriteLog, so you can see what I mean. I've changed names to
protect the innocent, but you'll get the gist. You'll also notice
that some of the rules I'm matching against are a little different
(more sophisticated) than I mention in my post above, but that
shouldn't make any difference because my issue isn't with rules
matching or not matching unexpectedly, but that the rules are getting
executed AT ALL. Basically what you can see is that it's looping
forever and redirecting to https. Thanks again.

x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
[rid#95652b0/initial] (2) init rewrite engine with requested uri /
admin/blah
x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
[rid#95652b0/initial] (3) applying pattern '^/webmail(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
[rid#95652b0/initial] (3) applying pattern '^/pipermail(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
[rid#95652b0/initial] (3) applying pattern '^/usage(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
[rid#95652b0/initial] (3) applying pattern '^/awstats(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
[rid#95652b0/initial] (3) applying pattern '^(.*)' to uri '/admin/
blah'
x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
[rid#95652b0/initial] (4) RewriteCond: input='/admin/blah' pattern='^/
admin($|(/.*$))' => matched
x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
[rid#95652b0/initial] (4) RewriteCond: input='/admin/blah' pattern='!^/
admin/trk_update\.php.*$' => matched
x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
[rid#95652b0/initial] (2) rewrite /admin/blah -> https://www.example.com/admin/blah
x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
[rid#95652b0/initial] (2) explicitly forcing redirect with
https://www.example.com/admin/blah
x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
[rid#95652b0/initial] (1) escaping https://www.example.com/admin/blah
for redirect
x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
[rid#95652b0/initial] (1) redirect to https://www.example.com/admin/blah
[REDIRECT/302]
x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (2) init rewrite engine with requested uri /
admin/blah
x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (3) applying pattern '^/webmail(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (3) applying pattern '^/pipermail(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (3) applying pattern '^/usage(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (3) applying pattern '^/awstats(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (3) applying pattern '^(.*)' to uri '/admin/
blah'
x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (4) RewriteCond: input='/admin/blah' pattern='^/
admin($|(/.*$))' => matched
x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (4) RewriteCond: input='/admin/blah' pattern='!^/
admin/trk_update\.php.*$' => matched
x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (2) rewrite /admin/blah -> https://www.example.com/admin/blah
x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (2) explicitly forcing redirect with
https://www.example.com/admin/blah
x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (1) escaping https://www.example.com/admin/blah
for redirect
x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (1) redirect to https://www.example.com/admin/blah
[REDIRECT/302]
x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (2) init rewrite engine with requested uri /
admin/blah
x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (3) applying pattern '^/webmail(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (3) applying pattern '^/pipermail(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (3) applying pattern '^/usage(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (3) applying pattern '^/awstats(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (3) applying pattern '^(.*)' to uri '/admin/
blah'
x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (4) RewriteCond: input='/admin/blah' pattern='^/
admin($|(/.*$))' => matched
x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (4) RewriteCond: input='/admin/blah' pattern='!^/
admin/trk_update\.php.*$' => matched
x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (2) rewrite /admin/blah -> https://www.example.com/admin/blah
x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (2) explicitly forcing redirect with
https://www.example.com/admin/blah
x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (1) escaping https://www.example.com/admin/blah
for redirect
x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (1) redirect to https://www.example.com/admin/blah
[REDIRECT/302]
x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
[rid#95632a8/initial] (2) init rewrite engine with requested uri /
admin/blah
x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
[rid#95632a8/initial] (3) applying pattern '^/webmail(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
[rid#95632a8/initial] (3) applying pattern '^/pipermail(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
[rid#95632a8/initial] (3) applying pattern '^/usage(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
[rid#95632a8/initial] (3) applying pattern '^/awstats(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
[rid#95632a8/initial] (3) applying pattern '^(.*)' to uri '/admin/
blah'
x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
[rid#95632a8/initial] (4) RewriteCond: input='/admin/blah' pattern='^/
admin($|(/.*$))' => matched
x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
[rid#95632a8/initial] (4) RewriteCond: input='/admin/blah' pattern='!^/
admin/trk_update\.php.*$' => matched
x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
[rid#95632a8/initial] (2) rewrite /admin/blah -> https://www.example.com/admin/blah
x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
[rid#95632a8/initial] (2) explicitly forcing redirect with
https://www.example.com/admin/blah
x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
[rid#95632a8/initial] (1) escaping https://www.example.com/admin/blah
for redirect
x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
[rid#95632a8/initial] (1) redirect to https://www.example.com/admin/blah
[REDIRECT/302]
x.x.x.x - - [04/Dec/2007:10:40:28 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (2) init rewrite engine with requested uri /
admin/blah
x.x.x.x - - [04/Dec/2007:10:40:28 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (3) applying pattern '^/webmail(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:28 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (3) applying pattern '^/pipermail(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:28 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (3) applying pattern '^/usage(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:28 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (3) applying pattern '^/awstats(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:28 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (3) applying pattern '^(.*)' to uri '/admin/
blah'
x.x.x.x - - [04/Dec/2007:10:40:28 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (4) RewriteCond: input='/admin/blah' pattern='^/
admin($|(/.*$))' => matched
x.x.x.x - - [04/Dec/2007:10:40:28 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (4) RewriteCond: input='/admin/blah' pattern='!^/
admin/trk_update\.php.*$' => matched
x.x.x.x - - [04/Dec/2007:10:40:28 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (2) rewrite /admin/blah -> https://www.example.com/admin/blah
x.x.x.x - - [04/Dec/2007:10:40:28 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (2) explicitly forcing redirect with
https://www.example.com/admin/blah
x.x.x.x - - [04/Dec/2007:10:40:28 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (1) escaping https://www.example.com/admin/blah
for redirect
x.x.x.x - - [04/Dec/2007:10:40:28 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (1) redirect to https://www.example.com/admin/blah
[REDIRECT/302]
x.x.x.x - - [04/Dec/2007:10:40:28 --0500] [www.example.com/sid#9289db8]
[rid#95632a8/initial] (2) init rewrite engine with requested uri /
admin/blah
x.x.x.x - - [04/Dec/2007:10:40:28 --0500] [www.example.com/sid#9289db8]
[rid#95632a8/initial] (3) applying pattern '^/webmail(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:28 --0500] [www.example.com/sid#9289db8]
[rid#95632a8/initial] (3) applying pattern '^/pipermail(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:28 --0500] [www.example.com/sid#9289db8]
[rid#95632a8/initial] (3) applying pattern '^/usage(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:28 --0500] [www.example.com/sid#9289db8]
[rid#95632a8/initial] (3) applying pattern '^/awstats(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:28 --0500] [www.example.com/sid#9289db8]
[rid#95632a8/initial] (3) applying pattern '^(.*)' to uri '/admin/
blah'
x.x.x.x - - [04/Dec/2007:10:40:28 --0500] [www.example.com/sid#9289db8]
[rid#95632a8/initial] (4) RewriteCond: input='/admin/blah' pattern='^/
admin($|(/.*$))' => matched
x.x.x.x - - [04/Dec/2007:10:40:28 --0500] [www.example.com/sid#9289db8]
[rid#95632a8/initial] (4) RewriteCond: input='/admin/blah' pattern='!^/
admin/trk_update\.php.*$' => matched
x.x.x.x - - [04/Dec/2007:10:40:28 --0500] [www.example.com/sid#9289db8]
[rid#95632a8/initial] (2) rewrite /admin/blah -> https://www.example.com/admin/blah
x.x.x.x - - [04/Dec/2007:10:40:28 --0500] [www.example.com/sid#9289db8]
[rid#95632a8/initial] (2) explicitly forcing redirect with
https://www.example.com/admin/blah
x.x.x.x - - [04/Dec/2007:10:40:28 --0500] [www.example.com/sid#9289db8]
[rid#95632a8/initial] (1) escaping https://www.example.com/admin/blah
for redirect
x.x.x.x - - [04/Dec/2007:10:40:28 --0500] [www.example.com/sid#9289db8]
[rid#95632a8/initial] (1) redirect to https://www.example.com/admin/blah
[REDIRECT/302]
x.x.x.x - - [04/Dec/2007:10:40:29 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (2) init rewrite engine with requested uri /
admin/blah
x.x.x.x - - [04/Dec/2007:10:40:29 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (3) applying pattern '^/webmail(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:29 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (3) applying pattern '^/pipermail(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:29 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (3) applying pattern '^/usage(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:29 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (3) applying pattern '^/awstats(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:29 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (3) applying pattern '^(.*)' to uri '/admin/
blah'
x.x.x.x - - [04/Dec/2007:10:40:29 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (4) RewriteCond: input='/admin/blah' pattern='^/
admin($|(/.*$))' => matched
x.x.x.x - - [04/Dec/2007:10:40:29 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (4) RewriteCond: input='/admin/blah' pattern='!^/
admin/trk_update\.php.*$' => matched
x.x.x.x - - [04/Dec/2007:10:40:29 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (2) rewrite /admin/blah -> https://www.example.com/admin/blah
x.x.x.x - - [04/Dec/2007:10:40:29 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (2) explicitly forcing redirect with
https://www.example.com/admin/blah
x.x.x.x - - [04/Dec/2007:10:40:29 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (1) escaping https://www.example.com/admin/blah
for redirect
x.x.x.x - - [04/Dec/2007:10:40:29 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (1) redirect to https://www.example.com/admin/blah
[REDIRECT/302]
x.x.x.x - - [04/Dec/2007:10:40:30 --0500] [www.example.com/sid#9289db8]
[rid#956c2c8/initial] (2) init rewrite engine with requested uri /
admin/blah
x.x.x.x - - [04/Dec/2007:10:40:30 --0500] [www.example.com/sid#9289db8]
[rid#956c2c8/initial] (3) applying pattern '^/webmail(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:30 --0500] [www.example.com/sid#9289db8]
[rid#956c2c8/initial] (3) applying pattern '^/pipermail(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:30 --0500] [www.example.com/sid#9289db8]
[rid#956c2c8/initial] (3) applying pattern '^/usage(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:30 --0500] [www.example.com/sid#9289db8]
[rid#956c2c8/initial] (3) applying pattern '^/awstats(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:30 --0500] [www.example.com/sid#9289db8]
[rid#956c2c8/initial] (3) applying pattern '^(.*)' to uri '/admin/
blah'
x.x.x.x - - [04/Dec/2007:10:40:30 --0500] [www.example.com/sid#9289db8]
[rid#956c2c8/initial] (4) RewriteCond: input='/admin/blah' pattern='^/
admin($|(/.*$))' => matched
x.x.x.x - - [04/Dec/2007:10:40:30 --0500] [www.example.com/sid#9289db8]
[rid#956c2c8/initial] (4) RewriteCond: input='/admin/blah' pattern='!^/
admin/trk_update\.php.*$' => matched
x.x.x.x - - [04/Dec/2007:10:40:30 --0500] [www.example.com/sid#9289db8]
[rid#956c2c8/initial] (2) rewrite /admin/blah -> https://www.example.com/admin/blah
x.x.x.x - - [04/Dec/2007:10:40:30 --0500] [www.example.com/sid#9289db8]
[rid#956c2c8/initial] (2) explicitly forcing redirect with
https://www.example.com/admin/blah
x.x.x.x - - [04/Dec/2007:10:40:30 --0500] [www.example.com/sid#9289db8]
[rid#956c2c8/initial] (1) escaping https://www.example.com/admin/blah
for redirect
x.x.x.x - - [04/Dec/2007:10:40:30 --0500] [www.example.com/sid#9289db8]
[rid#956c2c8/initial] (1) redirect to https://www.example.com/admin/blah
[REDIRECT/302]
x.x.x.x - - [04/Dec/2007:10:40:30 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (2) init rewrite engine with requested uri /
admin/blah
x.x.x.x - - [04/Dec/2007:10:40:30 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (3) applying pattern '^/webmail(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:30 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (3) applying pattern '^/pipermail(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:30 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (3) applying pattern '^/usage(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:30 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (3) applying pattern '^/awstats(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:30 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (3) applying pattern '^(.*)' to uri '/admin/
blah'
x.x.x.x - - [04/Dec/2007:10:40:30 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (4) RewriteCond: input='/admin/blah' pattern='^/
admin($|(/.*$))' => matched
x.x.x.x - - [04/Dec/2007:10:40:30 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (4) RewriteCond: input='/admin/blah' pattern='!^/
admin/trk_update\.php.*$' => matched
x.x.x.x - - [04/Dec/2007:10:40:30 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (2) rewrite /admin/blah -> https://www.example.com/admin/blah
x.x.x.x - - [04/Dec/2007:10:40:30 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (2) explicitly forcing redirect with
https://www.example.com/admin/blah
x.x.x.x - - [04/Dec/2007:10:40:30 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (1) escaping https://www.example.com/admin/blah
for redirect
x.x.x.x - - [04/Dec/2007:10:40:30 --0500] [www.example.com/sid#9289db8]
[rid#956e2d0/initial] (1) redirect to https://www.example.com/admin/blah
[REDIRECT/302]
x.x.x.x - - [04/Dec/2007:10:40:31 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (2) init rewrite engine with requested uri /
admin/blah
x.x.x.x - - [04/Dec/2007:10:40:31 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (3) applying pattern '^/webmail(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:31 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (3) applying pattern '^/pipermail(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:31 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (3) applying pattern '^/usage(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:31 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (3) applying pattern '^/awstats(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:31 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (3) applying pattern '^(.*)' to uri '/admin/
blah'
x.x.x.x - - [04/Dec/2007:10:40:31 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (4) RewriteCond: input='/admin/blah' pattern='^/
admin($|(/.*$))' => matched
x.x.x.x - - [04/Dec/2007:10:40:31 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (4) RewriteCond: input='/admin/blah' pattern='!^/
admin/trk_update\.php.*$' => matched
x.x.x.x - - [04/Dec/2007:10:40:31 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (2) rewrite /admin/blah -> https://www.example.com/admin/blah
x.x.x.x - - [04/Dec/2007:10:40:31 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (2) explicitly forcing redirect with
https://www.example.com/admin/blah
x.x.x.x - - [04/Dec/2007:10:40:31 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (1) escaping https://www.example.com/admin/blah
for redirect
x.x.x.x - - [04/Dec/2007:10:40:31 --0500] [www.example.com/sid#9289db8]
[rid#95672b8/initial] (1) redirect to https://www.example.com/admin/blah
[REDIRECT/302]
x.x.x.x - - [04/Dec/2007:10:40:31 --0500] [www.example.com/sid#9289db8]
[rid#95652b0/initial] (2) init rewrite engine with requested uri /
admin/blah
x.x.x.x - - [04/Dec/2007:10:40:31 --0500] [www.example.com/sid#9289db8]
[rid#95652b0/initial] (3) applying pattern '^/webmail(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:31 --0500] [www.example.com/sid#9289db8]
[rid#95652b0/initial] (3) applying pattern '^/pipermail(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:31 --0500] [www.example.com/sid#9289db8]
[rid#95652b0/initial] (3) applying pattern '^/usage(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:31 --0500] [www.example.com/sid#9289db8]
[rid#95652b0/initial] (3) applying pattern '^/awstats(.*)' to uri '/
admin/blah'
x.x.x.x - - [04/Dec/2007:10:40:31 --0500] [www.example.com/sid#9289db8]
[rid#95652b0/initial] (3) applying pattern '^(.*)' to uri '/admin/
blah'
x.x.x.x - - [04/Dec/2007:10:40:31 --0500] [www.example.com/sid#9289db8]
[rid#95652b0/initial] (4) RewriteCond: input='/admin/blah' pattern='^/
admin($|(/.*$))' => matched
x.x.x.x - - [04/Dec/2007:10:40:31 --0500] [www.example.com/sid#9289db8]
[rid#95652b0/initial] (4) RewriteCond: input='/admin/blah' pattern='!^/
admin/trk_update\.php.*$' => matched
x.x.x.x - - [04/Dec/2007:10:40:31 --0500] [www.example.com/sid#9289db8]
[rid#95652b0/initial] (2) rewrite /admin/blah -> https://www.example.com/admin/blah
x.x.x.x - - [04/Dec/2007:10:40:31 --0500] [www.example.com/sid#9289db8]
[rid#95652b0/initial] (2) explicitly forcing redirect with
https://www.example.com/admin/blah
x.x.x.x - - [04/Dec/2007:10:40:31 --0500] [www.example.com/sid#9289db8]
[rid#95652b0/initial] (1) escaping https://www.example.com/admin/blah
for redirect
x.x.x.x - - [04/Dec/2007:10:40:31 --0500] [www.example.com/sid#9289db8]
[rid#95652b0/initial] (1) redirect to https://www.example.com/admin/blah
[REDIRECT/302]

Re: Yet Another mod_rewrite SSL Question...

am 05.12.2007 22:12:22 von Davertron

On Dec 4, 11:17 am, Davertron wrote:
> On Dec 4, 9:15 am, Davertron wrote:
>
>
>
> > Hey Guys,
> > I'm having an interesting issue with redirecting http traffic to https
> > using mod_rewrite. First, I'll explain my setup a little bit. I'm
> > running Apache 2.0.52 on Redhat. I basically have something that
> > looks like this:
>
> > Listen 80
> > Listen x.x.x.x:443
>
> > NameVirtualHost *:80
> > NameVirtualHost *:443
>
> >
> > RewriteLog "/tmp/rewrite.log"
> > RewriteLogLevel 9
>
> > RewriteEngine on
> > RewriteCond %{REQUEST_URI} ^/admin [NC]
> > RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [NC,R,L]
> >

>
> >
> > (SSL Setup, etc.)
> >

>
> > So, the idea is that if the user tries to go to the /admin part of the
> > site, the request is redirected to SSL. This works correctly!
> > However, if the user tries to go to /admin/does_not_exist, I would
> > expect them to get redirected to https, and then for them to get a
> > 404. That is what I want to happen. However, what actually happens
> > is this:
>
> > * The http connection matches the RewriteCond for ^/admin, and so
> > is redirected to https (GOOD!)
> > * The https connection is then checked against the RewriteCond for
> > ^/admin, which it matches, and so it is redirected to https again
> > (HUH?)
> > * Rinse, repeat, indefinitely
>
> > I know this because I've enabled the RewriteLog and I can see it
> > happening in there. If I remove the RewriteRule from my insecure
> > vhost, the indefinite redirect on a file that does not exist goes away
> > and I get a 404 as I would expect, so I know the issue is with this
> > rewrite. So my question is basically this: why, after the connection
> > is redirected to https, do the RewriteRules in the insecure vhost get
> > checked at all? If I understand correctly those should never be run
> > because the https connection is on port 443. Am I missing something
> > here? I found this article (http://www.onlamp.com/pub/a/apache/
> > 2004/01/29/apache_ckbk.html) which describes the possibility of
> > looping if your redirect is not in the correct place in your config,
> > however I believe that in this case my setup matches the way they
> > describe.
>
> > I'm happy to post more info if someone needs it, and thanks in advance
> > for taking the time to read this far :)
>
> Hey, me again, not sure if this will help, but here's the output to
> the RewriteLog, so you can see what I mean. I've changed names to
> protect the innocent, but you'll get the gist. You'll also notice
> that some of the rules I'm matching against are a little different
> (more sophisticated) than I mention in my post above, but that
> shouldn't make any difference because my issue isn't with rules
> matching or not matching unexpectedly, but that the rules are getting
> executed AT ALL. Basically what you can see is that it's looping
> forever and redirecting to https. Thanks again.
>
> x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
> [rid#95652b0/initial] (2) init rewrite engine with requested uri /
> admin/blah
> x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
> [rid#95652b0/initial] (3) applying pattern '^/webmail(.*)' to uri '/
> admin/blah'
> x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
> [rid#95652b0/initial] (3) applying pattern '^/pipermail(.*)' to uri '/
> admin/blah'
> x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
> [rid#95652b0/initial] (3) applying pattern '^/usage(.*)' to uri '/
> admin/blah'
> x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
> [rid#95652b0/initial] (3) applying pattern '^/awstats(.*)' to uri '/
> admin/blah'
> x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
> [rid#95652b0/initial] (3) applying pattern '^(.*)' to uri '/admin/
> blah'
> x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
> [rid#95652b0/initial] (4) RewriteCond: input='/admin/blah' pattern='^/
> admin($|(/.*$))' => matched
> x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
> [rid#95652b0/initial] (4) RewriteCond: input='/admin/blah' pattern='!^/
> admin/trk_update\.php.*$' => matched
> x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
> [rid#95652b0/initial] (2) rewrite /admin/blah ->https://www.example.com/admin/blah
> x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
> [rid#95652b0/initial] (2) explicitly forcing redirect withhttps://www.example.com/admin/blah
> x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
> [rid#95652b0/initial] (1) escapinghttps://www.example.com/admin/blah
> for redirect
> x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
> [rid#95652b0/initial] (1) redirect tohttps://www.example.com/admin/blah
> [REDIRECT/302]
> x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
> [rid#956e2d0/initial] (2) init rewrite engine with requested uri /
> admin/blah
> x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
> [rid#956e2d0/initial] (3) applying pattern '^/webmail(.*)' to uri '/
> admin/blah'
> x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
> [rid#956e2d0/initial] (3) applying pattern '^/pipermail(.*)' to uri '/
> admin/blah'
> x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
> [rid#956e2d0/initial] (3) applying pattern '^/usage(.*)' to uri '/
> admin/blah'
> x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
> [rid#956e2d0/initial] (3) applying pattern '^/awstats(.*)' to uri '/
> admin/blah'
> x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
> [rid#956e2d0/initial] (3) applying pattern '^(.*)' to uri '/admin/
> blah'
> x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
> [rid#956e2d0/initial] (4) RewriteCond: input='/admin/blah' pattern='^/
> admin($|(/.*$))' => matched
> x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
> [rid#956e2d0/initial] (4) RewriteCond: input='/admin/blah' pattern='!^/
> admin/trk_update\.php.*$' => matched
> x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
> [rid#956e2d0/initial] (2) rewrite /admin/blah ->https://www.example.com/admin/blah
> x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
> [rid#956e2d0/initial] (2) explicitly forcing redirect withhttps://www.example.com/admin/blah
> x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
> [rid#956e2d0/initial] (1) escapinghttps://www.example.com/admin/blah
> for redirect
> x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
> [rid#956e2d0/initial] (1) redirect tohttps://www.example.com/admin/blah
> [REDIRECT/302]
> x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> [rid#95672b8/initial] (2) init rewrite engine with requested uri /
> admin/blah
> x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> [rid#95672b8/initial] (3) applying pattern '^/webmail(.*)' to uri '/
> admin/blah'
> x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> [rid#95672b8/initial] (3) applying pattern '^/pipermail(.*)' to uri '/
> admin/blah'
> x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> [rid#95672b8/initial] (3) applying pattern '^/usage(.*)' to uri '/
> admin/blah'
> x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> [rid#95672b8/initial] (3) applying pattern '^/awstats(.*)' to uri '/
> admin/blah'
> x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> [rid#95672b8/initial] (3) applying pattern '^(.*)' to uri '/admin/
> blah'
> x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> [rid#95672b8/initial] (4) RewriteCond: input='/admin/blah' pattern='^/
> admin($|(/.*$))' => matched
> x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> [rid#95672b8/initial] (4) RewriteCond: input='/admin/blah' pattern='!^/
> admin/trk_update\.php.*$' => matched
> x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> [rid#95672b8/initial] (2) rewrite /admin/blah ->https://www.example.com/admin/blah
> x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> [rid#95672b8/initial] (2) explicitly forcing redirect withhttps://www.example.com/admin/blah
> x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> [rid#95672b8/initial] (1) escapinghttps://www.example.com/admin/blah
> for redirect
> x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> [rid#95672b8/initial] (1) redirect tohttps://www.example.com/admin/blah
> [REDIRECT/302]
> x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> [rid#95632a8/initial] (2) init rewrite engine with requested uri /
> admin/blah
> x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> [rid#95632a8/initial] (3) applying pattern '^/webmail(.*)' to uri '/
> admin/blah'
> x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> [rid#95632a8/initial] (3) applying pattern '^/pipermail(.*)' to uri '/
> admin/blah'
> x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> [rid#95632a8/initial] (3) applying pattern '^/usage(.*)' to uri '/
> admin/blah'
> x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> [rid#95632a8/initial] (3) applying pattern '^/awstats(.*)' to uri '/
> admin/blah'
> x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> [rid#95632a8/initial] (3) applying pattern '^(.*)' to uri '/admin/
> blah'
> x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> [rid#95632a8/initial] (4) RewriteCond: input='/admin/blah' pattern='^/
> admin($|(/.*$))' => matched
> x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> [rid#95632a8/initial] (4) RewriteCond: input='/admin/blah' pattern='!^/
> admin/trk_update\.php.*$' => matched
> x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> [rid#95632a8/initial] (2) rewrite /admin/blah ->https://www.example.com/admin/blah...
>
> read more >>

Nm, I figured out the issue and it was not an Apache configuration
issue, it was a bug in the PHP code.

Re: Yet Another mod_rewrite SSL Question...

am 06.12.2007 04:03:50 von Iftekhar

On Dec 5, 9:12 pm, Davertron wrote:
> On Dec 4, 11:17 am, Davertron wrote:
>
> > On Dec 4, 9:15 am, Davertron wrote:
>
> > > Hey Guys,
> > > I'm having an interesting issue with redirecting http traffic to https
> > > using mod_rewrite. First, I'll explain my setup a little bit. I'm
> > > running Apache 2.0.52 on Redhat. I basically have something that
> > > looks like this:
>
> > > Listen 80
> > > Listen x.x.x.x:443
>
> > > NameVirtualHost *:80
> > > NameVirtualHost *:443
>
> > >
> > > RewriteLog "/tmp/rewrite.log"
> > > RewriteLogLevel 9
>
> > > RewriteEngine on
> > > RewriteCond %{REQUEST_URI} ^/admin [NC]
> > > RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [NC,R,L]
> > >

>
> > >
> > > (SSL Setup, etc.)
> > >

>
> > > So, the idea is that if the user tries to go to the /admin part of the
> > > site, the request is redirected to SSL. This works correctly!
> > > However, if the user tries to go to /admin/does_not_exist, I would
> > > expect them to get redirected to https, and then for them to get a
> > > 404. That is what I want to happen. However, what actually happens
> > > is this:
>
> > > * The http connection matches the RewriteCond for ^/admin, and so
> > > is redirected to https (GOOD!)
> > > * The https connection is then checked against the RewriteCond for
> > > ^/admin, which it matches, and so it is redirected to https again
> > > (HUH?)
> > > * Rinse, repeat, indefinitely
>
> > > I know this because I've enabled the RewriteLog and I can see it
> > > happening in there. If I remove the RewriteRule from my insecure
> > > vhost, the indefinite redirect on a file that does not exist goes away
> > > and I get a 404 as I would expect, so I know the issue is with this
> > > rewrite. So my question is basically this: why, after the connection
> > > is redirected to https, do the RewriteRules in the insecure vhost get
> > > checked at all? If I understand correctly those should never be run
> > > because the https connection is on port 443. Am I missing something
> > > here? I found this article (http://www.onlamp.com/pub/a/apache/
> > > 2004/01/29/apache_ckbk.html) which describes the possibility of
> > > looping if your redirect is not in the correct place in your config,
> > > however I believe that in this case my setup matches the way they
> > > describe.
>
> > > I'm happy to post more info if someone needs it, and thanks in advance
> > > for taking the time to read this far :)
>
> > Hey, me again, not sure if this will help, but here's the output to
> > the RewriteLog, so you can see what I mean. I've changed names to
> > protect the innocent, but you'll get the gist. You'll also notice
> > that some of the rules I'm matching against are a little different
> > (more sophisticated) than I mention in my post above, but that
> > shouldn't make any difference because my issue isn't with rules
> > matching or not matching unexpectedly, but that the rules are getting
> > executed AT ALL. Basically what you can see is that it's looping
> > forever and redirecting to https. Thanks again.
>
> > x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
> > [rid#95652b0/initial] (2) init rewrite engine with requested uri /
> > admin/blah
> > x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
> > [rid#95652b0/initial] (3) applying pattern '^/webmail(.*)' to uri '/
> > admin/blah'
> > x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
> > [rid#95652b0/initial] (3) applying pattern '^/pipermail(.*)' to uri '/
> > admin/blah'
> > x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
> > [rid#95652b0/initial] (3) applying pattern '^/usage(.*)' to uri '/
> > admin/blah'
> > x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
> > [rid#95652b0/initial] (3) applying pattern '^/awstats(.*)' to uri '/
> > admin/blah'
> > x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
> > [rid#95652b0/initial] (3) applying pattern '^(.*)' to uri '/admin/
> > blah'
> > x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
> > [rid#95652b0/initial] (4) RewriteCond: input='/admin/blah' pattern='^/
> > admin($|(/.*$))' => matched
> > x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
> > [rid#95652b0/initial] (4) RewriteCond: input='/admin/blah' pattern='!^/
> > admin/trk_update\.php.*$' => matched
> > x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
> > [rid#95652b0/initial] (2) rewrite /admin/blah ->https://www.example.com/admin/blah
> > x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
> > [rid#95652b0/initial] (2) explicitly forcing redirect withhttps://www.example.com/admin/blah
> > x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
> > [rid#95652b0/initial] (1) escapinghttps://www.example.com/admin/blah
> > for redirect
> > x.x.x.x - - [04/Dec/2007:10:40:25 --0500] [www.example.com/sid#9289db8]
> > [rid#95652b0/initial] (1) redirect tohttps://www.example.com/admin/blah
> > [REDIRECT/302]
> > x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
> > [rid#956e2d0/initial] (2) init rewrite engine with requested uri /
> > admin/blah
> > x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
> > [rid#956e2d0/initial] (3) applying pattern '^/webmail(.*)' to uri '/
> > admin/blah'
> > x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
> > [rid#956e2d0/initial] (3) applying pattern '^/pipermail(.*)' to uri '/
> > admin/blah'
> > x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
> > [rid#956e2d0/initial] (3) applying pattern '^/usage(.*)' to uri '/
> > admin/blah'
> > x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
> > [rid#956e2d0/initial] (3) applying pattern '^/awstats(.*)' to uri '/
> > admin/blah'
> > x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
> > [rid#956e2d0/initial] (3) applying pattern '^(.*)' to uri '/admin/
> > blah'
> > x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
> > [rid#956e2d0/initial] (4) RewriteCond: input='/admin/blah' pattern='^/
> > admin($|(/.*$))' => matched
> > x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
> > [rid#956e2d0/initial] (4) RewriteCond: input='/admin/blah' pattern='!^/
> > admin/trk_update\.php.*$' => matched
> > x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
> > [rid#956e2d0/initial] (2) rewrite /admin/blah ->https://www.example.com/admin/blah
> > x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
> > [rid#956e2d0/initial] (2) explicitly forcing redirect withhttps://www.example.com/admin/blah
> > x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
> > [rid#956e2d0/initial] (1) escapinghttps://www.example.com/admin/blah
> > for redirect
> > x.x.x.x - - [04/Dec/2007:10:40:26 --0500] [www.example.com/sid#9289db8]
> > [rid#956e2d0/initial] (1) redirect tohttps://www.example.com/admin/blah
> > [REDIRECT/302]
> > x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> > [rid#95672b8/initial] (2) init rewrite engine with requested uri /
> > admin/blah
> > x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> > [rid#95672b8/initial] (3) applying pattern '^/webmail(.*)' to uri '/
> > admin/blah'
> > x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> > [rid#95672b8/initial] (3) applying pattern '^/pipermail(.*)' to uri '/
> > admin/blah'
> > x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> > [rid#95672b8/initial] (3) applying pattern '^/usage(.*)' to uri '/
> > admin/blah'
> > x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> > [rid#95672b8/initial] (3) applying pattern '^/awstats(.*)' to uri '/
> > admin/blah'
> > x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> > [rid#95672b8/initial] (3) applying pattern '^(.*)' to uri '/admin/
> > blah'
> > x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> > [rid#95672b8/initial] (4) RewriteCond: input='/admin/blah' pattern='^/
> > admin($|(/.*$))' => matched
> > x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> > [rid#95672b8/initial] (4) RewriteCond: input='/admin/blah' pattern='!^/
> > admin/trk_update\.php.*$' => matched
> > x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> > [rid#95672b8/initial] (2) rewrite /admin/blah ->https://www.example.com/admin/blah
> > x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> > [rid#95672b8/initial] (2) explicitly forcing redirect withhttps://www.example.com/admin/blah
> > x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> > [rid#95672b8/initial] (1) escapinghttps://www.example.com/admin/blah
> > for redirect
> > x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> > [rid#95672b8/initial] (1) redirect tohttps://www.example.com/admin/blah
> > [REDIRECT/302]
> > x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> > [rid#95632a8/initial] (2) init rewrite engine with requested uri /
> > admin/blah
> > x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> > [rid#95632a8/initial] (3) applying pattern '^/webmail(.*)' to uri '/
> > admin/blah'
> > x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> > [rid#95632a8/initial] (3) applying pattern '^/pipermail(.*)' to uri '/
> > admin/blah'
> > x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> > [rid#95632a8/initial] (3) applying pattern '^/usage(.*)' to uri '/
> > admin/blah'
> > x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> > [rid#95632a8/initial] (3) applying pattern '^/awstats(.*)' to uri '/
> > admin/blah'
> > x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> > [rid#95632a8/initial] (3) applying pattern '^(.*)' to uri '/admin/
> > blah'
> > x.x.x.x - - [04/Dec/2007:10:40:27 --0500] [www.example.com/sid#9289db8]
> > [rid#95632a8/initial] (4)
>
> ...
>
> read more >>

Hey, Davertron.

Doesn't look like any gnostics are speaking up, so let me shoot in the
dark here...

Try setting the MaxRedirects directive to a suitable number? That
should put an end to the infinite loop... but doesn't address the core
issue...

- Ifty.