Handling files > 5GB fastly size limit via redirect?


Cheers folks. We’re serving a bunch of client assets via our site, and we’re using Fastly to cover the entirety of our web app. We’re running into problems where sometimes clients upload assets > 5GB, and we can’t determine that from the URL. Is there a way to (I know this sounds terrible) check the Content-Length: header in the beresp, and if its value is larger than (some number, probably just below Fastly’s 5GB limit) rather than proxy), return a redirect to the S3 URL instead (which is identical to the backend URL)?

I realize this may sound spaghetti-like, I’m typing it after a couple hours of beating my head. Any questions for clarification gratefully entertained, and suggestions/pointers greeted with huzzahs.