Forum: NGINX Limit serving to responses only below certain size

Posted by Calin Don (Guest)
on 2013-03-06 14:28
(Received via mailing list)
Hi,

Is there a way to server files only below a certain size?
eg. Return 403 on files bigger than 5MB?
Posted by Jonathan Matthews (Guest)
on 2013-03-06 16:30
(Received via mailing list)
On 6 March 2013 13:28, Calin Don <calin.don@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
Posted by Calin Don (Guest)
on 2013-03-06 20:28
(Received via mailing list)
Unfortunately the way big files are getting there is beyond my control.


On Wed, Mar 6, 2013 at 5:30 PM, Jonathan Matthews
Posted by Bob S. (Guest)
on 2013-03-06 21:07
(Received via mailing list)
Are you saying that you do not have administrative control of your 
system?

Jonathan is right - set policies that disallow large file sizes and 
enforce
them.

If necessary use chron to check for large files and remove them.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.