选择允许跨域的网站,选择设置,注意不要直接去修改Nginx配置无效& ?; v$ F8 z& ]* t
[color=var(--focus-color)] [url=] [/url]1 ~$ B0 N3 X* b( o
增加允许跨域访问配置。- W2 `' E8 E" G8 E- m* ]. M- C
[color=var(--focus-color)] [url=] [/url]
- F/ i7 }5 [# _. s3 p# U-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
( u# S: a2 U7 \" J2 ^add_header Access-Control-Allow-Origin *; //这里的“*”代表全部,也可以换成IP或者域名
" M: C& ]+ |/ _2 Dadd_header Access-Control-Allow-Headers Origin,Accept,Authorization,platformId,ut,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type;# M6 f, N9 g! I8 q7 t7 K
add_header Access-Control-Allow-Methods GET,POST,OPTIONS;5 l# u7 p0 V/ V" L- H1 G8 f: ?
add_header Access-Control-Allow-Credentials true;5 [, [, z1 p9 t- Q& ]- s2 j8 w/ l
|