【问题标题】:How to fix incorrect mime-type (atom-feed) showed in chrome-devtools?如何修复 chrome-devtools 中显示的不正确的 mime 类型(atom-feed)?
【发布时间】:2013-07-25 23:31:44
【问题描述】:

我不确定问题是因为错误的 PHP 代码还是错误的 nginx 配置。

我喜欢生成 atom 格式的提要。 Feed 的 XML 有效。我确实通过

设置了内容类型
header("Content-type: application/atom+xml");

在我发布 XML 之前。尽管如此,我还是从 chromium 开发者工具中获得了不同的信息。

Network 中的表格视图将 text/plain 显示为类型:



但是,标头本身似乎没问题,因为它声明了 application/atom+xml



这个 mime-type 在 nginx-configuration 中正确设置:

types {
        [...]
        application/atom+xml                    atom;
        [...]
}



Chromium 无法识别我的提要的正确 mime 类型并将其声明为 text/plain 可能会丢失/错误?

【问题讨论】:

  • 咨询第三方——试试curl -itext/plain 是否可能只是 Chromium 内容处理的产物?

标签: php nginx google-chrome-devtools mime-types atom-feed


【解决方案1】:

问题似乎是 Chrome 无法识别 application/*+xml 内容类型。看起来您需要使用普通的旧 application/xml 来获得 XSLT 处理和正确的 Content-Type 显示以在开发工具中工作。

【讨论】:

  • 这似乎既可复制又令人恼火,因为我切换到静态提供 xml 作为预构建文件而不是使用 php 生成它,并且:内容类型今天被 chrome 正确识别,是写这篇文章的时间,我很确定。
猜你喜欢
  • 2020-07-24
  • 2020-05-18
  • 1970-01-01
  • 2012-09-21
  • 1970-01-01
  • 2012-11-29
  • 2012-04-13
  • 2011-11-14
相关资源
最近更新 更多