You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Steve Penner <st...@gmail.com> on 2013/01/09 13:36:01 UTC

[users@httpd] Setting Directory Listings Only To One Subnet

A friend of mine posted the message below the '====' for me recently.  He told me that it went unanswered, although he told me it might have gone unanswered because it was a holiday time.

I would like to confirm that what I want to do is not possible:

====

I have directory "abc" from the document root whose content is available to all,
including subnet 192.168.1.

But ONLY subnet 192.168.1 can do a directory listing.

What's my set up in httpd.conf?

   <Directory "Z:/service.web/abc">
      Options +Indexes
      AllowOverride None
      Order allow,deny         
      Allow from all

   </Directory>


####
Server: Apache2.4.3  for Windows
OS: Win7(64-bit)
server running on  ASUS G74SX
using dynamic DNS
connection to Internet:  aDSL line rate: up 1022 Kbps, down 4904 Kbps
server interfaced to PHP 5.4.8, MySQL 5.0.10


--
SP

 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Setting Directory Listings Only To One Subnet

Posted by Daniel Gruno <ru...@cord.dk>.
On 01/09/2013 01:36 PM, Steve Penner wrote:
> A friend of mine posted the message below the '====' for me recently.  He told me that it went unanswered, although he told me it might have gone unanswered because it was a holiday time.
> 
> I would like to confirm that what I want to do is not possible:
> 
> ====
> 
> I have directory "abc" from the document root whose content is available to all,
> including subnet 192.168.1.
> 
> But ONLY subnet 192.168.1 can do a directory listing.
> 
> What's my set up in httpd.conf?
> 
>    <Directory "Z:/service.web/abc">
>       Options +Indexes
>       AllowOverride None
>       Order allow,deny         
>       Allow from all
> 
>    </Directory>
> 
> 
> ####
> Server: Apache2.4.3  for Windows
> OS: Win7(64-bit)
> server running on  ASUS G74SX
> using dynamic DNS
> connection to Internet:  aDSL line rate: up 1022 Kbps, down 4904 Kbps
> server interfaced to PHP 5.4.8, MySQL 5.0.10
> 
> 
> --
> SP
> 
>  
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 

If you want only 192.168.1.* to do directory listings, but you want the
content to be available to everybody, you need to use an If clause:

<Directory "Z:/service.web/abc">
    Options -Indexes
    <If "%{REMOTE_ADDR} =~ /^192\.168\.1\./">
        Options +Indexes
    </If>
</Directory>


With regards,
Daniel.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org