Vue访问接口跨域异常如下:

跨域问题-Allow-Origin header contains multiple values... but only one is allowed_运维

1.F12看 Network的请求头是否多个 (如果有多个 则会有上面的问题)

跨域问题-Allow-Origin header contains multiple values... but only one is allowed_Network_02

2.解决方法:

检查nginx配置 是否存在多个

去掉只留一个就行(留代码或者nginx的都行)

跨域问题-Allow-Origin header contains multiple values... but only one is allowed_Network_03

 

add_header Access-control-Allow-Origin *;