chrome里面ajax无法发送请求,nginx控制ajax同步

问题:

今天做项目有个服务器遇到一个问题,

1)ajax无法发送同步请问,改为true后就可以了, firefox浏览器没有问题,chrome有问题

2)相同的core,其他服务器没有问题,就这个服务器遇到了这样的问题

检查:

查看页面的header,debug->网络->输入url,e.g:login.admin。查看header里面的请求参数

对比chrome里面不同服务器的header.发现header里面的请求参数不一样

3)在nginx.conf里面找到相应的参数,对比得出:

有问题的服务器设置了:

add_header Feature-Policy sync-xhr 'none';

就是这个设置,拦截了同步请求,修改为sync-xhr 'self';

就OK了

 

补充:

the sync-xhr setting:
'*': It is allowed in both pages and embedded iframes.
'self': Allowed on the page, only the same source resources are allowed to be used in the embedded iframes.
'src': Only the attributes that are valid in the iframe, only the src attribute in the iframe is allowed to use the same resource as the set header.
'none': All prohibited in pages and inline.
<origin(s)>: Allowed to be used in a specific origin, multiple origins can be separated by spaces.

'*' and 'none' are used alone, 'self' and 'src' can be used side by side with one or more origins.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值