https跨域到http问题解决
整体结构
⽤户--https-->Nginx--http-->Tomcat
页⾯中包含了iframe,iframe的src也是Https的,但是当frame⾥⾯的内容表单提交后tomcat服务器处理成功想要重定向却⽆法正常重定
向,Chrome报错如下
Mixed Content: The page at '...../#' was loaded over HTTPS, but requested an insecure form action '.../**/**'. This request has been blocked; the content must be served over HTTPS.
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; #获取真实ip
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
defalut
server {
listen 80 default_server;
server_name localhost;
return 301 $server_name:6663$request_uri;
}
server {
listen 6663;
server_name localhost;
ssl on;
ssl_certificate /home/dream/Https/ssl/;
ssl_certificate_key /home/dream/Https/ssl/server/server.pem;
ssl_client_certificate /home/dream/Https/ssl/;
ssl_session_timeout 5m;
ssl_verify_client on; #开户客户端证书验证
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;
location / {
proxy_pass 127.0.0.1:8080/;
}
}
解决⽅式在nginx配置⽂件添加:
nginx ssl证书配置proxy_pass 127.0.0.1:8080/;
proxy_redirect ~^([^:]+)(:\d+)?(.*)$ $1$3;
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论