0
VUE資源:VUE資源:訪問控制允許來源錯誤
Vue.http.post(API_URL + '/jwt/access_token', credentials, {
headers: {
'Access-Control-Allow-Origin': true
}
}).then(response => {
console.log(response.data)
}, err => reject(err))
我的API正確地與CORS laravel配置..
我得到這個錯誤:
XMLHttpRequest cannot load http://finance.app/jwt/access_token. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.
請求頭:
OPTIONS /jwt/access_token HTTP/1.1
Host: finance.app
Connection: keep-alive
Access-Control-Request-Method: POST
Origin: http://localhost:8080
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36
Access-Control-Request-Headers: access-control-allow-origin, content-type
Accept: */*
Referer: http://localhost:8080/
Accept-Encoding: gzip, deflate, sdch
Accept-Language: pt-BR,pt;q=0.8,en-US;q=0.6,en;q=0.4
我要去哪裏? :(
感謝
那麼,怎麼樣的響應頭? – gurghet
問題解決了。 在vue-resource中沒有設置,但laravel中有一個小的middlware配置錯誤。 謝謝。 – Giovanne