My good fellow gamedevers. I need your help once again!
I am thinking of writing a file server that can accept file uploads, authenticate the uploader, and stream the bytes directly to S3. I thought it was going to be quick, but somehow I am having problem finding the solution.
I was expecting there's going to be a whole range of solutions and apps out there that can do the job, but Googling here and there doesn't seem to resolve to any particular, convincing solution, and I am hesitant to write my own.
My use case:
1. Authenticate user before accepting file upload. There will be a token in the Authorization header. File server should authenticate the token with the auth server before accepting file upload. HTTP 100-Continue seems to be at play here.
2. Once it's authenticated, stream the bytes directly to S3. Depending on Content-Type, put files into different S3 buckets. At this point, there's no association/ownership between users and files on S3. File ownership is described at the DB.
3. This is completely optional: show some progress bar to the users. This took me to this awesome page, which describes the protocol of resumable uploads and displaying progress bar, which means that a custom homegrown solution is needed.
First, I ran into nginx upload module. Seems to do the job just fine, but it can only seem to upload directly to the disk, then I have to write another app that pulls that file from disk, and stream to S3. What about the authentication beforehand? Unless I am mistaken, this doesn't sound to be a good long term solution.
Then ran into various blogs of people's endeavors using Passenger/Ruby/Python/PHP/node.js/nginx/jQuery and whatever stuff, and the solutions seem to be very "heavy" on getting the proper values to your config files. Just no. Some of them are at the hobbyist level, loading the entire file in memory and save them on disks, which is what the nginx module has already done.
This should have been done already. File upload is like an ancient technology of the Atlanteans. There has to be the one true way of doing this, but the answer seems very elusive now, or maybe I am searching for the wrong thing. My search result did get mixed up with these free file hosting servers ads.