.htaccess issues

Guilherme guilherme.e at gmail.com
Fri Feb 10 19:40:25 UTC 2012


This would fix the problem, but I don't know the directories that has a
.htaccess file with allow/deny.


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

I would like to bypass cache in this cases, maybe using proxy_cache_bypass,
but I don't know how. Any idea?

On Fri, Feb 10, 2012 at 4:08 PM, Adrián Navarro <adrian at navarro.at> wrote:

> Then there is no way you can cache. Pass everything for these dirs
> (/downloads) and filter htaccess with x-forwarded-for (make sure its being
> sent by nginx).
> By pure logic, the only way there would be to set the IP whitelist in the
> nginx config and check it even for cached items hit.
> Sent from my BlackBerry
> --
> Adrián Navarro / (+34) 608 831 094
> -----Original Message-----
> From: Guilherme <guilherme.e at gmail.com>
> Sender: nginx-bounces at nginx.orgDate: Fri, 10 Feb 2012 15:57:31
> To: <nginx at nginx.org>
> Reply-To: nginx at nginx.org
> Subject: Re: .htaccess issues
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20120210/511c47db/attachment.html>

More information about the nginx mailing list