#4786·jimureport

JimuChatBI index 页面资源地址硬编码 http://,HTTPS 反代下 Mixed Content 白屏(forward-headers/apiBasePath 均无效)

Author: yangyang1187Created Sep 15, 2026Updated Sep 16, 2026
版本号:
  • jimureport-spring-boot4-starter 2.5.2(jimureport-example master 分支构建)
  • jimuchatbi-spring-boot4-starter 1.0.0
  • JDK 17(Alibaba Dragonwell 17.0.19)/ Spring Boot 4.1.0 / MySQL 8.0.46
  • 反向代理:nginx 1.x,HTTPS 站点(443 → 127.0.0.1:8085)
问题描述:

通过 nginx HTTPS 反向代理访问 JimuChatBI 页面 /jimu/chat2bi/index 时整页空白

原因:ChatBI index 页面渲染出的所有静态资源(js/css/logo)均为硬编码 http:// 协议的绝对地址(如 http://<host>/chat2bi/libs/vue/vue.min.js),在 HTTPS 页面中触发浏览器 Mixed Content 拦截,全部资源加载失败 → 白屏。

已验证以下常规手段均无法让其输出 https://

  1. server.forward-headers-strategy: native(以及 framework)——无效。nginx 已正确传递 X-Forwarded-Proto: https,页面仍输出 http:// 前缀;
  2. jeecg.jmreport.apiBasePath: https://<domain>——对 chat2bi 页面资源地址无效(关闭 nginx sub_filter 后实测页面仍有 30 处 http://<domain> 引用);
  3. sa-token 登录态本身正常:同一环境下 /jmreport/list(报表工作台)可正常打开,仅 chat2bi 页面存在该问题。

后端日志无异常(接口均 200),纯粹是页面模板生成资源 URL 时 scheme 固定为 http://(疑似只读取 Host 头拼接,未读取 X-Forwarded-Proto / 未走 Spring forward-headers 机制)。

目前只能靠 nginx sub_filter 改写响应体兜底:

nginx
proxy_set_header Accept-Encoding "";
sub_filter_once off;
sub_filter_types text/html application/javascript text/css;
sub_filter "http://<domain>" "https://<domain>";
错误日志&截图:

浏览器 Console(HTTPS 页面下全部资源被拦截):

Mixed Content: The page at 'https://<domain>/jimu/chat2bi/index' was loaded over HTTPS,
but requested an insecure script 'http://<domain>/chat2bi/libs/vue/vue.min.js?v=2.7.16'.
This request has been blocked; the content must be served over HTTPS.

服务端返回的页面源码(经 nginx HTTPS 反代,且已传 X-Forwarded-Proto: https):

xml
<link rel="icon" type="image/png" href="http://<domain>/chat2bi/logo.png?v=157">
<script src="http://<domain>/chat2bi/libs/vue/vue.min.js?v=2.7.16"></script>
<link href="http://<domain>/chat2bi/libs/iview/iview.css?v=4.7.0" rel="stylesheet">
...共 30 处 http:// 绝对地址

对照:直接 http://<server>:8085/jimu/chat2bi/index 访问时页面正常(协议一致无拦截),可确认问题仅在 HTTPS 反代场景。

重现步骤:
  1. 官方 jimureport-example(含 jimuchatbi-spring-boot4-starter 1.0.0)连接 MySQL、执行 jimureport.mysql5.7.create.sql 后启动(dev profile,端口 8085);
  2. nginx 配置 HTTPS server(443)反代到 127.0.0.1:8085,并设置:
    nginx
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Proto https;
  3. application-dev.yml 增加 server.forward-headers-strategy: native
  4. 浏览器访问 https://<domain>/jimu/chat2bi/index,用 yml 中 spring.security.user 账号登录;
  5. 现象:页面空白,Console 报大量 Mixed Content 拦截,查看页面源码所有资源前缀为 http://<domain>
  6. 对比 /jmreport/list 同环境可正常打开。

期望:chat2bi index 页面资源地址应尊重 X-Forwarded-Proto(或支持配置强制 https / 改为相对路径),与 /jmreport/list 行为一致。

相关历史 issue(同类问题在大屏/仪表盘模块曾多次出现):#3338 #3134 #3236