Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have configured apache authentication for one of my domain. I want that apache should not prompt for password for local ips and for *.myexternaldomain.com. Currently with the following configuration it is working fine for only myexternaldomain.com.

    Order deny,allow
    Deny from all
    AllowOverride All
    AuthType Basic
    AuthName "Webyog Gateway Authentication"
    AuthUserFile /etc/httpd/httpdpasswd
    Require user webyog
    Allow from myexternaldomain.com 192.168.1.0/24
    Satisfy Any

How can I allow wild card domains like *.myexternaldomain.com in the above configuration ?

Warm Regards

Supratik

share|improve this question

3 Answers 3

up vote 1 down vote accepted

This configuration already allows *.myexternaldomain.com, but as the apache docs say:

This configuration will cause Apache to perform a double reverse DNS lookup on the client IP address, regardless of the setting of the HostnameLookups directive. It will do a reverse DNS lookup on the IP address to find the associated hostname, and then do a forward lookup on the hostname to assure that it matches the original IP address. Only if the forward and reverse DNS are consistent and the hostname matches will access be allowed.

I guess, your reverse DNS Lookup for the subdomains of myexternaldomain.com is not working as expected.

share|improve this answer
1  
Yes, you are correct. The reverse DNS will not work because the sub domains are hosted in a server whose IP is shared between the VirtualHost. Is there any workaround to skip reverse DNS lookup ? –  Supratik Dec 6 '10 at 9:02

Have a look at this link. This configuration should work! See the example below:

A (partial) domain-name
    Example:

    Allow from apache.org
    Allow from .net example.edu

    Hosts whose names match, or end in, this string are allowed access. Only complete components are matched, so the above example will match foo.apache.org but it will not match fooapache.org. 
share|improve this answer

You should write 2 Allow directives:

Allow from myexternaldomain.com 
Allow from 192.168.1.0/24

But, as heiko wrote, to use a domanin name is not a good practice.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.