The resource is interpreted as a document, but is transmitted with the mime type / stream octet pdf

I don’t know why I was faced with this problem, not being able to download pdf files in the Chrome browser, the error below appears on the Nginx server.

the resource is interpreted as a document, but is transmitted with the mime type / stream octet pdf

Although I have included the mime type as an application / pdf

+7
source share
3 answers

If this is just a warning, just ignore it! This is just Chrome.

If not, try including the MIME type as application/octet-stream .

+1
source

try using these examples in your code.

Pdfobject

this is the classic version: if you can download localhost: 8080 / xyz123 / PdfFile.pdf, write this:

 <iframe src="./xyz123/PdfFile.pdf" title="title"> <a href="./xyz123/PdfFile.pdf"> ... </a> </iframe> 
0
source

A similar problem occurred to me only for .pdf files. I changed the application pool identifier to Network Service and this fixed the problem.

I'm not sure why it worked, as the response header still had the same Content-Type , but it worked.

0
source

Source: https://habr.com/ru/post/951198/


All Articles