【问题标题】:Chrome gives a 401 error for manifest.jsonChrome 为 manifest.json 提供 401 错误
【发布时间】:2021-11-22 14:29:12
【问题描述】:

我有一个 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"
        }
    ] }

我看到的错误是:

{"timestamp":"2021-09-30T18:34:24.329+00:00","status":401,"error":"Unauthorized","message":"","path":"/manifest.json"}

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

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

【问题讨论】:

    标签: spring-boot google-chrome progressive-web-apps flutter-web manifest.json


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-07-11
      • 1970-01-01
      • 1970-01-01
      • 2016-04-24
      • 2016-02-18
      • 1970-01-01
      • 2016-08-27
      • 1970-01-01
      相关资源
      最近更新 更多