5. Drawbacks
● slower because it uses server as a temporary cache
● File is first uploaded to server and then streamed to S3.
● No indication how much file has been uploaded.
● Large file uploads can cause Heroku timeout.
6. Direct Upload to S3
● aws-sdk
● jQuery-File-Upload plugin
● enable CORS on S3 bucket
(reference)
(reference)
7. Cross-site HTTP Requests
● Domain A (http://domaina.example) making a request
for a resource on Domain B (http://domainb.foo), such
as an image (http://domainb.foo/image.jpg).
● Cross-site HTTP requests initiated from within scripts
(Ajax) are restricted to same-origin policy due to
security reasons (phishing).
8. CORS (Cross Origin Resource Sharing)
● A way for web servers to support cross-site access
controls.
● enable secure cross-site data transfers.
(reference)
9. Background Job
● using binary data-type (blob)
● read the file and save it in record
● Background job will upload it to S3