.htaccess issues

António P. P. Almeida appa at perusio.net
Fri Feb 10 17:32:37 UTC 2012


On 10 Fev 2012 17h08 WET, guilherme.e at gmail.com wrote:

> I'm starting to use nginx as a proxy/cache (apache back-end), and
> I've a problem regarding directories that uses .htaccess to restrict
> access by ip (allow,deny).
>
> The first time when a allowed IP access this area (i.e. /downloads),
> the object is cached, but when a unauthorized IP access the same
> dir, it gets the object from cache.
>
> Is there a way to deal with that?

At the http level:

geo $not_allowed {
    default 1;
    127.0.0.1 0;
    192.168.45.0/24 0;
}

Then add in the cache config:

proxy_cache_bypass $not_allowed;

--- appa



More information about the nginx mailing list