I have a storage server providing downloading services in an intranet. Recently I've added a reverse proxy on a gateway so the download services are accessible from the internet. However because bandwidth costs and paired with other reasons, I would like to restrict the maximum file size for a single request, say one MiB.
I have currently two ideas
- Configure Nginx on the origin server to deny access to files exceeding the threshold
- Configure Nginx on the gateway to respond with some 4xx code once the proxy backend responds with a big value in
Content-Length
header.
I still haven't Googled out how to do either (any one of the ideas suffices).
In case it helps: The origin server runs stock Nginx from Debian APT repository, while the gateway runs OpenResty (Nginx with LUA). I however am not familiar with LUA.
0 Answers