How to allow wildcard domains in apache

8,965

Solution 1

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.

Solution 2

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:
8,965

Related videos on Youtube

Supratik
Author by

Supratik

Updated on September 17, 2022

Comments

  • Supratik
    Supratik almost 2 years

    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

  • Supratik
    Supratik over 13 years
    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 ?