xuxueli / xxl-job

A distributed task scheduling framework.(分布式任务调度平台XXL-JOB)
http://www.xuxueli.com/xxl-job/
GNU General Public License v3.0
27.45k stars 10.86k forks source link

Https重定向到Http问题 #2015

Open specYyt opened 3 years ago

specYyt commented 3 years ago

Please answer some questions before submitting your issue. Thanks!

Which version of XXL-JOB do you using?

2.2.0

Expected behavior

Https重定向到Https

Actual behavior

Https重定向到Http

Steps to reproduce the behavior

访问 https://xxxx.com/xxl-job-admin,重定向到登录页,但是302后的结果是Http

Other information

1111

ygxxii commented 1 year ago

类似的 issue 还有:#1068

我也遇到了类似的问题,我的解决方案是使用 NGINX 的 proxy_redirect http https; 配置将 xxl-job-admin 返回 302 时的 Location: http://.... 修改为 Location: https://....

以下是我的示例配置,实测环境:Docker 镜像 xuxueli/xxl-job-admin 版本 2.3.12.2.0


示例一、使用默认 Context Path /xxl-job-admin,则可以配置 NGINX:

    listen  443 ssl;
    # ...

    location /xxl-job-admin {
        proxy_pass http://xxl-job:8080/xxl-job-admin;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_redirect http https;
    }

示例二、修改 Context Path 了,如 /xxl_xxl/admin,则可以配置 NGINX:

    listen  443 ssl;
    # ...

    location /xxl_xxl/admin {
        proxy_pass http://xxl-job:8080/xxl_xxl/admin;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_redirect http https;
    }

NGINX 配置重点: