Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to restrict certain domains from accessing services on my app server. For example;

I want to create a filter on my Apache server which will match all requests for this servlet and check the domain and if trusted allow access.

What is the best way to do this? Initially i thought i could create a Virtual host and then apply the mod_authz_host module however the virtual host can only map to a domain and port and ignores everything after the port.

Any suggestions? This is how far i got

<VirtualHost mydomain>
    <Location />
       Order Deny,Allow
       Deny from all
       Allow from

This will block access to the entire site and not just the sensitiveInformationServlet servlet

share|improve this question

So specify it.

<VirtualHost *:80>
    DocumentRoot /your/fancy/web/site
    <Location /SensitiveInformationURL>
       Order Deny,Allow
       Deny from all
       Allow from

Matching clients by domain is expensive since it requires a PTR lookup for every request.
I also corrected your faulty VirtualHost.

share|improve this answer

Your Answer


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.