Welcome! Log In Create A New Profile

Advanced

Looking to returning a 302 Redirect if a file is above a certain size...

May 21, 2013 01:27AM
Hey there,

I was looking for some guidance for a project I'm working on.

We're looking into CDNs here, and we are specifically looking for a decent origin pull service that also supports denying by referrer to prevent hotlinking. However, as it turns out almost all origin pull services *except* a service we'll call ACF restrict you to 100MB or less.

As we're not looking to have bulletproof hotlinking protection, we've determined that the best way to handle it is to serve files through the main CDN (we'll call them FSL), but have our nginx cluster return a 302 redirect if the file the "client" is requesting is over 100MB. I've confirmed with FSL that they will honor and cache that 302, which would then send clients to ACF in as clean a fashion as possible.

The long and short is: I'm trying to work out how to make nginx return a 302 if a file is over 100MB, which I'm told the Lua module should be capable of. Seeking some advice on how to do so as I'm hopeless with Lua and my searches turned up nothing.

Thanks,
~ Benjamin
Subject Author Posted

Looking to returning a 302 Redirect if a file is above a certain size...

barntzen May 21, 2013 01:27AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 167
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready