-->

cookies 超时下iframe重定向异常

2020-12-04 12:55发布

问题:

网站是asp .net core(.net core 3.1) + docker +nginx反向代理,docker里面的asp .net core服务用的是http, nginx使用https反向代理。

网页内用了iframe,当cookies过期时,用户点击导航页内的a标签<a href="/xxx" target="iframe">xx</a> 触发重定向,但是因为主页面是https,iframe重定向返回的url是http的,触发chrome浏览器安全机制(ie,edge浏览器无此问题),导致界面无响应,必须要重新刷新整个网页进行整体跳转。

请问怎么保持asp .net core为http的情况下解决这个问题,其他情况下的跳转都是正常的,只有在cookies过期时触发的重定向出现异常。感觉是nginx配置哪里有什么问题。。请大佬帮忙看下,相互学习,谢谢。

nginx的配置参照官网的说明:
https://docs.microsoft.com/zh-cn/aspnet/core/host-and-deploy/linux-nginx?view=aspnetcore-3.1#configure-nginx

Chrome浏览器报错如下:
Mixed Content: The page at 'https://xxxxxxxx/' was loaded over HTTPS, but requested an insecure resource 'http://xxxxxxxx/login?ReturnUrl=xxxxxxxx'. This request has been blocked; the content must be served over HTTPS.

回答1:

确认了是代理的问题,只能先强制转成https了
proxy_redirect http:// https://;