Jeecg tomcat running behind nginx over https

To setup Nginx force https to tomcat follow https://www.cnblogs.com/kevingrace/p/6187072.html, here the author provided several ways to force http to https and I used this config

    listen 80;
    server_name dev.wangshibo.com;
    index index.html index.php index.htm;
    access_log  /usr/local/nginx/logs/8080-access.log main;
    error_log  /usr/local/nginx/logs/8080-error.log;
    return      301 https://$server_name$request_uri;      //这是nginx最新支持的写法
    location ~ / {
    root /var/www/html/8080;
    index index.html index.php index.htm;

but still access http in tomcat for some of the resources files with error:

Mixed Content: The page at ‘https://xxxx.com” was loaded over HTTPS, but requested an insecure script ‘http://xxxx.com/xxxxxxx’. This request has been blocked; the content must be served over HTTPS.

Then here’s the correct way to proxy tomcat over https https://blog.csdn.net/catoop/article/details/70247993

    # HTTPS server
    server {
        listen       443 ssl;
        server_name  wxss.andyxin.cn;
        ssl_certificate   cert/1535025099947.pem;
        ssl_certificate_key  cert/1535025099947.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:82;
location /jeecg {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_pass http://127.0.0.1:8080/jeecg;

http://www.viqsoft.com/blog/2018/09/24/jeecg-tomcat-running-behind-nginx-over-https/

华为云优惠多多,更有新用户低至4折,欢迎点击此处或者扫码进入