Tuesday, November 17, 2015

How to create dummy virtual host in Apache to avoid cache poisoning



To avoid cache poisoning, I was asked to create a dummy virtual host on my Apache Web Server, so that all the forged requests(which are not actually related to my application) will go to the dummy virtual host.



Below is my current virtual host:




DocumentRoot "cache location"
ServerName myappname




I'm trying to create a dummy virtual host with Server name as * and with a different cache location. This is what I tried:




DocumentRoot "another cache location"
ServerName *




How can I test that my dummy virtual host configuration works, and do I need to modify my configuration?


Answer



As far as I know setting * as the ServerName will only match a literal * as the hostname and that does not do not the intended wildcard matching...



Your dummy virtual host , the VirtualHost entry that will respond to any and all unqualified requests that don't match any of the specific domain names that are explicitly configured, should by the first VirtualHost entry in your configuration.




# This is the first and will handle anything that is not example.[com | net | org]
...



ServerName example.com
...


ServerName example.net
...



ServerName example.org
...



The second part of this answer has a suitable setup for the default VirtualHOST: https://serverfault.com/a/662356/37681


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...