download - Issue with downloading PDF from S3 on Chrome -



download - Issue with downloading PDF from S3 on Chrome -

i'm facing issue on downloading pdf files amazon s3 using chrome.

when click link, controller redirect request file's url on s3.

it works firefox, nil happens chrome.

yet, if perform right click -> save location as download file ...

and copy-paste of s3 url chrome lead blank screen ...

here info returned curl:

date: wed, 01 feb 2012 15:34:09 gmt last-modified: wed, 01 feb 2012 04:45:24 gmt accept-ranges: bytes content-type: application/x-pdf content-length: 50024 server: amazons3

my guesses related issue content type ... tried didn't work.

the canonical internet media type pdf document application/pdf defined in the application/pdf media type (rfc 3778) - please note application/x-pdf, while commonly encountered , listed media type in portable document format well, notably absent official application media types listed internet assigned numbers authorization (iana).

i'm not aware of why , when application/x-pdf came life, apparently chrome pdf plugin not open application/x-pdf documents of today.

consequently should able trigger different behavior in chrome changing media type of stored objects accordingly.

alternative (for authenticated requests)

another approach force pdf download instead of letting chrome effort open it, can done means of triggering content-diposition: attachment header get request - please see s3 documentation get object on how accomplish via response-content-disposition request parameter, response-content-disposition=attachment demonstrated there in section sample request parameters altering response header values.

this available authenticated requests though, see section request parameters:

note

you must sign request, either using authorization header or pre-signed url, when using these parameters. can not used unsigned (anonymous) request.

google-chrome download amazon-s3 content-type

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -