【问题标题】:Configure nginx to serve manifest.json file in web app配置 nginx 以在 Web 应用程序中提供 manifest.json 文件
【发布时间】:2018-12-09 10:05:17
【问题描述】:

在我的网络应用程序中,我在开发控制台中出现此错误:

GET /manifest.json 401 (Unauthorized)
manifest.json:1 Manifest: Line: 1, column: 1, Unexpected token.
login:1 Site cannot be installed: the manifest could not be fetched, is empty, or could not be parsed

如果我直接在浏览器url中调用json文件是可以的,但是我的app不能调用这个文件,因为nginx返回401错误:

<link rel="manifest" href="/manifest.json">

如何在 nginx 中允许此文件?

【问题讨论】:

  • 你在github查看过同样的问题吗?

标签: nginx manifest progressive-web-apps


【解决方案1】:

在我的例子中,这个错误在我添加了 crossorigin 属性后解决了:

<link rel="manifest" href="./manifest.json" crossorigin="use-credentials">

【讨论】:

  • 非常感谢。这应该被接受为答案。
猜你喜欢
  • 1970-01-01
  • 2010-09-05
  • 2018-12-08
  • 2017-01-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多