首页 > 解决方案 > Chrome 为 manifest.json 提供 401 错误

问题描述

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

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

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

标签: spring-bootgoogle-chromeprogressive-web-appsflutter-webmanifest.json

解决方案


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


推荐阅读