Web Servers General Talk - rewrite loops

This is Interesting: Free IT Magazines  
Home > Archive > Web Servers General Talk > January 2004 > rewrite loops





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author rewrite loops
manfred

2004-01-19, 6:32 am

I got a ssl-proxy that works fine with this rule set.
lockfile is also defined.

RewriteEngine on
#RewriteLog /dev/null
#RewriteLog 0
RewriteLog /var/log/apache/sslproxy.log
RewriteLogLevel 1
RewriteMap lowercase int:tolower

RewriteMap domaindb txt:/etc/apache/ssldomains
RewriteRule ^/icons/(.+) - [L]
# msie v6
RewriteRule ^/w3c/(.+) - [L]
# lowercase
RewriteRule ^/([^/]+)/(.*) /${lowercase:$1}/$2 [S=1]
RewriteRule ^/(.*) /${lowercase:$1}

RewriteRule ^/www\.([^/]+)/(.*)
/${domaindb:$1|%{HTTP_HOST}/$1}/$2 [S=2]
RewriteRule ^/([^/]+)/(.*)
/${domaindb:$1|%{HTTP_HOST}/$1}/$2 [S=1]
RewriteRule ^/(.+) /$1/ [R,L]
RewriteRule ^/(.*) http://$1 [P,L]


Now I got squirrelmail installed with a virtual domain pointing at
webmail.domain.tld
So I thought I put in a rule to send everything through the proxy to get
ssl encrytpion like so:

RewriteEngine on
#
RewriteRule ^/([^/]+)/(.*) https://ssl.domain.tld/webmail/$1/$2

Now I thought everything should be fine, but when I go to
webmail.domain.tld I see that the request is sort of hanging in a loop and
doesn't get that page delivered.

Any suggestions what I've done wrong?

Cheers
manfred

2004-01-19, 6:32 am

Nobody has an idea what I'm talking about? :-(
I must really have messed it up :-)

Am Fri, 21 Nov 2003 23:23:17 +0100 hat manfred <dfn@tictric.net>
geschrieben:
quote:

> I got a ssl-proxy that works fine with this rule set.
> lockfile is also defined.
>
> RewriteEngine on
> #RewriteLog /dev/null
> #RewriteLog 0
> RewriteLog /var/log/apache/sslproxy.log
> RewriteLogLevel 1
> RewriteMap lowercase int:tolower
>
> RewriteMap domaindb txt:/etc/apache/ssldomains
> RewriteRule ^/icons/(.+) - [L]
> # msie v6
> RewriteRule ^/w3c/(.+) - [L]
> # lowercase
> RewriteRule ^/([^/]+)/(.*) /${lowercase:$1}/$2 [S=1]
> RewriteRule ^/(.*) /${lowercase:$1}
>
> RewriteRule ^/www\.([^/]+)/(.*)
> /${domaindb:$1|%{HTTP_HOST}/$1}/$2 [S=2]
> RewriteRule ^/([^/]+)/(.*)
> /${domaindb:$1|%{HTTP_HOST}/$1}/$2 [S=1]
> RewriteRule ^/(.+) /$1/ [R,L]
> RewriteRule ^/(.*) http://$1 [P,L]
>
>
> Now I got squirrelmail installed with a virtual domain pointing at
> webmail.domain.tld
> So I thought I put in a rule to send everything through the proxy to get
> ssl encrytpion like so:
>
> RewriteEngine on
> #
> RewriteRule ^/([^/]+)/(.*) https://ssl.domain.tld/webmail/$1/$2
>
> Now I thought everything should be fine, but when I go to
> webmail.domain.tld I see that the request is sort of hanging in a loop
> and doesn't get that page delivered.
>
> Any suggestions what I've done wrong?
>
> Cheers



Joachim Ring

2004-01-19, 6:32 am

manfred <dfn@tictric.net> wrote in message news:<opry1oboxyiiuxj6@news.cis.dfn.de>...
quote:

> Nobody has an idea what I'm talking about? :-(
> I must really have messed it up :-)


<snip>[QUOTE][color=darkred]

no wonder. you're having no break condition in that redirect to the
ssl proxy. so:

http://webmail.domain.tld/foo/bar.html ->
https://ssl.domain.tld/webmail/foo/bar.html ->
https://ssl.domain.tld/webmail/webmail/foo/bar.html ...
ad infinitum

you want something like

RewriteCond %{REQUEST_URI} !^/webmail

in front of the above RewriteRule. also it helps to have a look into a
rewrite log on your own it usually gets clear very fast then...

but i did like the reverse-proxy setup using the rewrite-map.

joachim
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2009 webservertalk.com