linux debian 11
社区版:v1.10.7-lts
跨域配置:
错误呈现
1、若报错提示中含有 The value of the ‘Access-Control-Allow-Credentials’ header in the response is.
新增向用户的头
字段名:Access-Control-Allow-Credentials值:true
字段名:Access-Control-Allow-0rigin 值:*
2、若报错提示中含有 No’Access-Control-Allow-Origin’ header
新增向用户的头
字段名:Access-Control-Allow-0rigin 值:*
3、若报错提示中含有 Method xxX is not allowed Access-Control-Allow-Methods
新增向用户的头
字段名:Access-Control-Allow-Methods 值)上面的XXX
好的 我尝试一下
你把那个跨域处理往上提一层
add_header Access-Control-Allow-Origin '*' always;
add_header Access-Control-Allow-Methods '*' always;
add_header Access-Control-Allow-Headers '*' always;
if ($request_method = 'OPTIONS') {
return 200;
}
放到sever里面,你现在只是针对/下面的路由进行跨域处理了
像我这样子(Nginx的配置,差不多的,大概看看就行了)
好的呢 谢谢朋友的帮助
您这个参数配置 可以生效
谢谢官方和楼上朋友的帮助!
为啥按上面的操作还是不生效哦