在和后臺人員關(guān)于接口token的設(shè)置吏垮,我放在請求header中
結(jié)果铺根,放到線上,請求報(bào)錯:
Access to XMLHttpRequest at 'https://*******/Login/login' from origin '********' has been blocked by CORS policy: Request header field x-token is not allowed by Access-Control-Allow-Headers in preflight response.
image.png
一直以為是跨域的,后臺能改的都改了茄袖。結(jié)果查資料才知道九秀,是請求header中設(shè)置的x-token,在返回header中沒有详瑞,將response的header里加上x-token就可以了。
浪費(fèi)了好長時(shí)間臣缀,心好累