Re: Redirecting based on IP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

The staging site is even protected with a RequireAll statement for the DocumentRoot based on the IP, which then results in a 404 and other errors in GSC.
That sound wrong. If your RequireAll was working as advertised, should
it not return a 403?

Yes, it does - my mistake.

The next steps I'd like to do is to redirect anyone not in that RequireAll statement to be redirected to the production site. Is this possible? Perhaps a RewriteCond that depends upon certain IPs, then otherwise redirects to the production site?
I don't think relying on the IPs is a good idea, since those will
change, and the proper process to validate them requires 2 DNS
lookups, if I'm not mistaken. Just use a rewriteCond + rewriteRule to
generously check the User-Agent and perform the redirect. You may have
to set an environment variable in the rewrite rule and check that in
your RequireAll statement to permit the 301 response to be sent. You
may want to verify that the Vary:User-Agent response header gets sent
to the client to prevent cache pollution.

I used your rewritecond+rewriterule approach, and it worked perfectly in my tests. Thanks so much.




[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux