httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dieter Vrancken <>
Subject [users@httpd] Allow from - requiring both a http header and an IP range
Date Wed, 20 Jul 2005 13:43:47 GMT
Hi all,

This issue seems very simple at first, but I can't figure out
how to make it work. I'm using Apache 1.3.33 on Debian sarge.

I want to allow access to a directory based on the following
- user comes from IP range A or
- user comes from IP range B or
- user comes from IP range C _and_ has a specific HTTP header
  set to a predefined value

<Directory /some/dir>
  Order deny,allow
  Deny from all
  Allow from ip_range_a
  Allow from ip_range_b
  # now what ?

I've searched the docs and mailing list for similar questions,
but couldn't find anything like it. What can I add to allow
users from the last range with the header set?

There doesn't seem to be a way to combine multiple conditions
into one "Allow from" statement (and'ed that is). Likewise,
SetEnvIf can't take two pieces of info into account. I've
tried combining the conditions using mod_rewrite (1) in a
rather clumsy way, but that doesn't seem to work either.

What am I missing? Surely I'm not the first one to want to do
this. Could you point me in the right direction?

Please enlighten me,

(1) using something like this in the Directory block
  RewriteCond %{REMOTE_ADDR} ^xxx\.yyy\.zzz
  RewriteCond %{HTTP_X_MAGIC} magic_value
  RewriteRule (.*) $1 [E=RANGE_C]
  Allow from env=RANGE_C

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message