资源被解释为图像,但使用MIME类型的应用程序/八位字节流传输

Resource interpreted as Image but transferred with MIME type application/octet-stream

本文关键字:应用程序 类型 八位 传输 字节流 MIME 解释 图像 资源      更新时间:2023-09-26

加载页面时,我收到以下警告:

Resource interpreted as Image but transferred with MIME type application/octet-stream

我的页面正在加载jpeg图像。服务器将图像字节写入输出流,并将其发送到客户端。

我该怎么做才能防止这种警告?

您必须设置正确的Mime类型
为图像设置正确的Content-Type http标头
例如,jpeg图像将具有Content-Type: image/jpeg

相关文章: