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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
"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. |
|
|||
|
"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 |
|
|||
|
> 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 | |
|
|