.htaccess issues

Guilherme guilherme.e at gmail.com
Sun Feb 12 15:37:33 UTC 2012


On Fri, Feb 10, 2012 at 6:08 PM, Max <nginxyz at mail.ru> wrote:

>
> 10 февраля 2012, 23:40 от Guilherme <guilherme.e at gmail.com>:
> > This would fix the problem, but I don't know the directories that has a
> > .htaccess file with allow/deny.
> >
> > Example:
> >
> > Scenario: nginx (cache/proxy) + back-end apache
> >
> > root at srv1 [~]# ls -a /home/domain/public_html/restrictedimages/
> > ./  ../  .htaccess  image.jpg
> > root at srv1 [~]# cat /home/domain/public_html/restrictedimages/.htaccess
> > allow from x.x.x.x
> > deny from all
> >
> > In the first access (source IP: x.x.x.x) to
> > http://domain.com/restrictedimages/image.jpg, nginx proxy request to
> apache
> > and cache response. The problem comes in other request from other  IP
> > address different from x.x.x.x. Nginx deliver the objects from cache,
> even
> > if the ip address is not authorized, because nginx doesn't understand
> > .htaccess.
> >
> > I would like to bypass cache in this cases, maybe using
> proxy_cache_bypass,
> > but I don't know how. Any idea?
>
> You could use this:
>
> proxy_cache_key $scheme$remote_addr$host$$server_port$request_uri;
>
> This would make originating IP addresses ($remote_addr) part of
> the cache key, so different clients would get the correct responses
> from the cache just as if they were accessing the backend directly,
> there's no need to bypass the cache at all.
>
> Max
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>

Max, good idea, but in the other requests, that I want to cache responses,
the cache size will grow too fast, because the same object will be cached a
lot of times, cause the ip adress is in the cache key (one cache entry per
IP).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20120212/8c9d028c/attachment.html>


More information about the nginx mailing list