rewrite results not as expected

This is a discussion on rewrite results not as expected within the Linux Web Servers forums, part of the Web Server and Related Forums category; Hi i am testing an example ruleset from the rewrite guide but the log does not show what i expected ...


Go Back   Usenet Forums > Web Server and Related Forums > Linux Web Servers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-02-2003
Obantec Support
 
Posts: n/a
Default rewrite results not as expected

Hi

i am testing an example ruleset from the rewrite guide but the log does not
show what i expected to see.

rule

RewriteEngine on
RewriteMap hosts-deny txt:/home/domain/domain1/logs/.hosts.deny
RewriteCond ${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND} !=NOT-FOUND [OR]
RewriteCond ${hosts-deny:%{REMOTE_HOST}|NOT-FOUND} !=NOT-FOUND
RewriteRule ^/.* - [F]

extract of log shows

cache lookup OK: map=hosts-deny[txt] key=62.252.224.5 -> val=
RewriteCond: input='NOT-FOUND' pattern='!=NOT-FOUND' => not-matched
cache lookup OK: map=hosts-deny[txt] key=62.252.224.5 -> val=
RewriteCond: input='NOT-FOUND' pattern='!=NOT-FOUND' => not-matched

now i expected second condition to input key with remote_host
*inktomi2-lee.server.ntl.com* not the remote_addr.

since in the hosts.deny there will be ip's and hosts.

Any idea where i need to look?

Ultimate goal is to send a list of band ip's to a new url.

Mark


  #2 (permalink)  
Old 07-03-2003
Joshua Slive
 
Posts: n/a
Default Re: rewrite results not as expected

"Obantec Support" <usenet@obantec.com> wrote in message news:<vg6dccnd6t5u44@news.supernews.com>...

> now i expected second condition to input key with remote_host
> *inktomi2-lee.server.ntl.com* not the remote_addr.
>
> since in the hosts.deny there will be ip's and hosts.
>
> Any idea where i need to look?


See the HostnameLookups directive. With this set to off,
REMOTE_HOST is the same as REMOTE_ADDR.

Joshua.
  #3 (permalink)  
Old 07-03-2003
Obantec Support
 
Posts: n/a
Default Re: rewrite results not as expected

"Joshua Slive" <google@slive.ca> wrote in message
news:916ecaf4.0307030746.732f2446@posting.google.c om...
> "Obantec Support" <usenet@obantec.com> wrote in message

news:<vg6dccnd6t5u44@news.supernews.com>...
>
> > now i expected second condition to input key with remote_host
> > *inktomi2-lee.server.ntl.com* not the remote_addr.
> >
> > since in the hosts.deny there will be ip's and hosts.
> >
> > Any idea where i need to look?

>
> See the HostnameLookups directive. With this set to off,
> REMOTE_HOST is the same as REMOTE_ADDR.
>
> Joshua.


Hi

It is off but a test script shows the expected values for REMOTE_HOST and
REMOTE_ADDR

REMOTE_ADDR = 62.252.224.5
REMOTE_HOST = inktomi2-lee.server.ntl.com

which throw me. (but i guess its the cache that is providing remote_host
var)

using a non cache connection and remote_host is gone.

Turning it On gives expected results.

So thanks i now understand and have reduced the rule just to remote_addr
since i am not interested in remote_host or the overhead of extra dns to
look up remote_host.

Mark


  #4 (permalink)  
Old 07-03-2003
Joachim Ring
 
Posts: n/a
Default Re: rewrite results not as expected

> i am testing an example ruleset from the rewrite guide but the log does not
> show what i expected to see.
>
> rule
>
> RewriteEngine on
> RewriteMap hosts-deny txt:/home/domain/domain1/logs/.hosts.deny
> RewriteCond ${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND} !=NOT-FOUND [OR]
> RewriteCond ${hosts-deny:%{REMOTE_HOST}|NOT-FOUND} !=NOT-FOUND
> RewriteRule ^/.* - [F]
>
> extract of log shows
>
> cache lookup OK: map=hosts-deny[txt] key=62.252.224.5 -> val=
> RewriteCond: input='NOT-FOUND' pattern='!=NOT-FOUND' => not-matched
> cache lookup OK: map=hosts-deny[txt] key=62.252.224.5 -> val=
> RewriteCond: input='NOT-FOUND' pattern='!=NOT-FOUND' => not-matched
>
> now i expected second condition to input key with remote_host
> *inktomi2-lee.server.ntl.com* not the remote_addr.


i suspect that you're lacking a HostnameLookups On clause in your
setup. it defaults to off since apache 1.3 and then there's no
symbolic name for clients available. beware though that this will add
latency to your pages and load to your network & server - so only use
it if absolutely necessary.

joachim
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 11:34 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0