Skip to content

控制台前端 CSP 策略导致部分图标加载失败 #655

@beijixiaohu

Description

@beijixiaohu
  • I have searched the issues of this repository and believe that this is not a duplicate.

Ⅰ. Issue Description

在部署 Higress Console 后,发现控制台界面部分图标(img.alicdn.com)无法加载,浏览器控制台报错提示 CSP 拦截。

经排查,原因是前端代码构建时硬编码了 CSP 策略,且未放行阿里云 CDN 域名

此外,个人觉得UI 资源不应依赖公网 CDN,而应打包在容器镜像内。

Ⅱ. Describe what happened

访问控制台时,界面部分图标会被CSP阻止。 浏览器 Console 报错如下:

Refused to load the image 'https://img.alicdn.com/imgextra/...' because it violates the following Content Security Policy directive: "img-src 'self' data:".

Ⅲ. Describe what you expected to happen

应该将所有 alicdn 的静态资源(图标等)直接打包进 Docker 镜像(本地化),彻底移除对公网 CDN 的依赖。

如果必须保留 CDN 引用,请修正前端硬编码的 CSP 策略。

Ⅳ. How to reproduce it (as minimally and precisely as possible)

  1. 部署 Higress Console。
  2. 通过浏览器访问控制台。
  3. 打开开发者工具(F12),查看 Console 面板的红色报错。

Ⅴ. Anything else we need to know?

Ⅵ. Environment:

  • Higress version: Latest
  • OS : Linux / K8s
  • Others: Chrome Browser

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions