Limit serving to responses only below certain size

Calin Don calin.don at gmail.com
Wed Mar 6 19:28:13 UTC 2013


Unfortunately the way big files are getting there is beyond my control.


On Wed, Mar 6, 2013 at 5:30 PM, Jonathan Matthews
<contact at jpluscplusm.com>wrote:

> On 6 March 2013 13:28, Calin Don <calin.don at gmail.com> wrote:
> > Hi,
> >
> > Is there a way to server files only below a certain size?
> > eg. Return 403 on files bigger than 5MB?
>
> Assuming you're talking about local filesystem files, you might try to
> proxy_pass back round to yourself, and do an if() based on
> $upstream_http_content_length.
>
> If you're already proxy'ing, you could use the same technique but
> without the double nginx hit.
>
> I'd personally look at /how/ too-large files are getting onto disk,
> and fix that, however.
>
> Jonathan
> --
> Jonathan Matthews // Oxford, London, UK
> http://www.jpluscplusm.com/contact.html
>
> _______________________________________________
> 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/20130306/ffdc2ff1/attachment.html>


More information about the nginx mailing list