You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Industrial Blue <in...@yahoo.com> on 2010/06/23 17:37:59 UTC

[users@httpd] .htaccess deny question

I'm having a heck of a time trying to get this to work.  I have a .htaccess file which is working fine.  I now have a requirement to restrict/deny any server ending with the letter 'n' from example.com

For example, I want to deny the server 123n.example.com but still allow all other servers (not ending in 'n') from example.com

I have tried everything like:

deny from *n\.example\.com
deny from .*n\.example\.com
deny from ^*n\.example\.com

Is what I am trying to do outside the scope of allow/deny?  Thanks much.



      


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] .htaccess deny question

Posted by Tom Evans <te...@googlemail.com>.
On Thu, Jun 24, 2010 at 5:22 PM, Industrial Blue
<in...@yahoo.com> wrote:
> Here you are:
>
> order allow,deny
> deny from 12.3.80
> deny from 12.3.81
> ...
> deny from *n\.example.com
> ErrorDocument 403 "This IP is blocked."
> allow from all
>
>
> That's it!  Thanks for any help.
>

That is incorrect syntax. It will be looking for an explicit host name
of '*n\.example.com'. That sort of wildcard expansion is not supported
by Allow/Deny directive, see here for docs:

http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html#allow

If you need to do this sort of access checking (seems a bit nuts to me
- you can escape it by changing your dns name?), then you must follow
the example in the docs of setting an environment variable to denote
whether access should be allowed, and then using that environment
variable to allow/deny access.

Eg:

SetEnvIf Remote_Host *n\.example\.com bad_src_server=1
<Location />
  Order deny,allow
  Deny from env=bad_src_server
</Location>

Cheers

Tom

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] .htaccess deny question

Posted by Industrial Blue <in...@yahoo.com>.
Here you are:

order allow,deny
deny from 12.3.80
deny from 12.3.81
...
deny from *n\.example.com
ErrorDocument 403 "This IP is blocked."
allow from all



That's it!  Thanks for any help.




________________________________
From: Igor Cicimov <ic...@gmail.com>
To: users@httpd.apache.org
Sent: Wed, June 23, 2010 11:21:27 PM
Subject: Re: [users@httpd] .htaccess deny question


Post the complete case including the order statement. Also i dont think you need the backslashes.

Sent from my phone
On Jun 24, 2010 1:38 AM, "Industrial Blue" <in...@yahoo.com> wrote:
>
>I'm having a heck of a time trying to get this to work.  I have a .htaccess file which is working fine.  I now have a requirement to restrict/deny any server ending with the letter 'n' from example.com
>
>>For example, I want to deny the server 123n.example.com but still allow all other servers (not ending in 'n') from example.com
>
>>I have tried everything like:
>
>>deny from *n\.example\.com
>>deny from .*n\.example\.com
>>deny from ^*n\.example\.com
>
>>Is what I am trying to do outside the scope of allow/deny?  Thanks much.
>
>
>
>
>
>
>>---------------------------------------------------------------------
>>The official User-To-User support forum of the Apache HTTP Server Project.
>>See http://httpd.apache.org/userslist.html> for more info.
>>To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
>>For additional commands, e-mail: users-help@httpd.apache.org
>
>


      

Re: [users@httpd] .htaccess deny question

Posted by Igor Cicimov <ic...@gmail.com>.
Post the complete case including the order statement. Also i dont think you
need the backslashes.

Sent from my phone

On Jun 24, 2010 1:38 AM, "Industrial Blue" <in...@yahoo.com> wrote:

I'm having a heck of a time trying to get this to work.  I have a .htaccess
file which is working fine.  I now have a requirement to restrict/deny any
server ending with the letter 'n' from example.com

For example, I want to deny the server 123n.example.com but still allow all
other servers (not ending in 'n') from example.com

I have tried everything like:

deny from *n\.example\.com
deny from .*n\.example\.com
deny from ^*n\.example\.com

Is what I am trying to do outside the scope of allow/deny?  Thanks much.






---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
  "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org