xhr.js:108 Refused to set unsafe header "Cookie"


 

https://stackoverflow.com/questions/7210507/ajax-post-error-refused-to-set-unsafe-header-connection/7210840

 

Remove these two lines:

xmlHttp.setRequestHeader("Content-length", params.length); xmlHttp.setRequestHeader("Connection", "close");

XMLHttpRequest isn't allowed to set these headers, they are being set automatically by the browser. The reason is that by manipulating these headers you might be able to trick the server into accepting a second request through the same connection, one that wouldn't go through the usual security checks - that would be a security vulnerability in the browser.

 

// request interceptor
service.interceptors.request.use(
    config => {
        // do something before request is sent
        // console.log(store.getters.token)
        config.headers['Access-Control-Allow-Origin'] = '*'
        config.headers['cache-control'] = 'max-age=1,s-maxage=1'
        config.headers['Cookie'] = 'noBy-interceptors.request'

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM