Chrome 给出了 manifest.json 的 401 错误

jav*_*hak 9 google-chrome spring-boot flutter progressive-web-apps manifest.json

我有一个 Flutter UI(Web 通道)应用程序,它部署为捆绑的 Spring-boot 应用程序(构建文件放入 Spring-boot 项目中的 main/resources 文件夹中)。我面临的问题是,每次在 Chrome 中加载应用程序并登录时,我都会看到指向 manifest.json 的 401 错误。当我使用 Android Studio 在本地测试我的 UI 时,我没有遇到同样的问题。此设置使用在 Docker 中运行的 spring-boot 应用程序的修改版本。

我的manifest.json 文件是:

{
  "name": "ccccc",
  "short_name": "ccccc",
  "start_url": "/#/",
  "display": "standalone",
  "background_color": "#0175C2",
  "theme_color": "#0175C2",
  "description": "basicapp",
  "orientation": "landscape-primary",
  "prefer_related_applications": false,
  "icons": [
    {
      "src": "icons/cd-16.png",
      "sizes": "16x16",
      "type": "image/png"
    },
    {
      "src": "icons/cd-32png",
      "sizes": "32x32",
      "type": "image/png"
    },
    {
      "src": "icons/cd-64.png",
      "sizes": "64x64",
      "type": "image/png"
    },
    {
      "src": "icons/cd-256.png",
      "sizes": "256x256",
      "type": "image/png"
    }
  ]
}
Run Code Online (Sandbox Code Playgroud)

我看到的错误是:

{"timestamp":"2021-09-30T18:34:24.329+00:00","status":401,"error":"Unauthorized","message":"","path":"/manifest.json"}
Run Code Online (Sandbox Code Playgroud)

我认为这个问题与此类似,但该修复不起作用。然后我从我的index.html 中删除了对manifest.json 的引用。<link rel="manifest" href="manifest.json">消除了错误,但不确定这是否是正确的做法。

不确定这里的问题是什么,它不会阻止我登录应用程序,但将其视为控制台日志中的第一件事只是令人烦恼。非常感谢任何解决此问题的帮助/协助。

小智 18

您应该在必须使用标签的地方尝试解决方案。我遇到了和你一样的问题,这解决了它。希望你也一样!<link>crossorigin="use-credentials"