Hi,
I am trying to write a web application that will serve uploaded files, and let the uploader specify the content type. For this to work, I need to be able to control the content-type when I serve the file. With most web-servers I'm aware of (e.g. Apache), the best I can do in that respect is set an appropriate suffix and hope that nobody uploads a file with an "unsupported" content-type. What I would like to do instead is set the content-type in my code processing the request -- e.g. have a database record describing the file and pull it from there. But then, it seems I would need to serve the whole file from my application, as if it were dynamic, and pay a severe performance penalty (among other things, losing the ability to serve it directly from CDNs such as Amazon S3).
So the question is --
Is there a way for me to tell a web browser "Take the file from that URL, but use the content-type supplied in the redirect response"?
Is there a less-optimal solution, which would still allow me to use a static-content-server for the file while using a dynamic application for the content-type?
Thanks, Shai.