1

During a recent audit we became aware of several users who have not set their DNS records to correctly point to our name servers.

Since we don't control the domain names of our users directly, we're not exactly sure what they've done wrong. All we know is that their users are hitting our origin server, not our caching proxy.

I would like to use Apache's mod_rewrite in the vhosts configs of affected users to redirect users to our caching proxy if they are not coming from it already. I envision something like this:

RewriteCond %{REMOTE_ADDR} !^PROXY.SERVER.IP.ADDRESS$
RewriteRule "^/?(.*)" "http://PROXY.SERVER.IP.ADDRESS/$1"

However, this won't preserve the client's HTTP host header. Is there a sensible way to do this that will preserve the client's HTTP host header?

  • I used to manage about 1000 Internet based servers for a global telecom all through proxies of various kinds. The domain name IP address was always the core set of proxies on the edge of our network. In your case, I am not sure why whatever domain name you tell your users to use is not pointing to a proxy instead of the web server. – closetnoc Jun 28 '15 at 18:15
  • I should specify that this only happens with some of our users -- the ones who have set their panel to use our name servers are doing fine. In the case of the bad users, I think they are setting the A Record or DNS redirect to point directly to our origin server's IP address instead of handing us full domain control. – DMCoding Jun 28 '15 at 23:43
  • My point is this: It is difficult to get people to do anything like that. If they are using myapp.example.com then myapp.example.com should be a proxy that handles everything for the user- not the web server. I am talking about public DNS records not private. – closetnoc Jun 28 '15 at 23:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.