问题描述:请求到的图片地址单独访问能显示,但是在网页中展示不出来
原因:https中直接访问http是不行的,需要用nginx再转发一下
nginx配置如下(注意:9000是minio默认端口,已经占用,所以这里监听9001)
server {
listen 9001 ssl;
server_name 172.19.129.9;
ssl_certificate localhost.pem;
ssl_certificate_key localhost-key.pem;
location /defect/ {
proxy_pass http://172.19.129.9:9000/defect/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Redis中存minio上传成功的url也是要替换http为https的,端口9000也要替换为9001
String imgUrl = FileUploadUtils.uploadMinio(img);
imgUrl = imgUrl.replace("localhost","172.19.129.9");
imgUrl = imgUrl.replace("http","https");
imgUrl = imgUrl.replace("9000","9001");