Mobile app version of vmapp.org
Login or Join
Nimeshi995

: Using mod_rewrite to force users to use our caching proxy During a recent audit we became aware of several users who have not set their DNS records to correctly point to our name servers.

@Nimeshi995

Posted in: #Apache2 #Dns #ModRewrite #Redirects #ReverseProxy

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/"


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?

10% popularity Vote Up Vote Down


Login to follow query

More posts by @Nimeshi995

0 Comments

Sorted by latest first Latest Oldest Best

Back to top | Use Dark Theme