'AWS Web Servers some PDF Files don't display on the webpage, instead they automatically download
Good day,
I'm currently trying to display PDF files in an iFrame but for some reason, they just auto-download whenever I visit the links. Here's a file which auto-downloads: Here's a file which displays as normal:
Solution 1:[1]
The difference between your 2 files is the Content-Type:
The first has Content-Type: application/octet-stream
The second has Content-Type: application/pdf
application/octet-stream is considered an unknown binary file and browsers download it directly (https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types#applicationoctet-stream).
You can fix it by going to the S3 console and changing the first file Content-Type metadata to application/pdf. More information on editing metadata: https://docs.aws.amazon.com/AmazonS3/latest/userguide/add-object-metadata.html
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | ?????? ?????? |
