2017-02-22 92 views
0

運行Chrome 56和我得到記錄在我的控制檯下面的信息進行交叉原點取():提取API無法加載的http://本地主機:3000

Fetch API cannot load http://localhost:8080/transaction. 
No 'Access-Control-Allow-Origin' :3000/#/1 header is present on the requested resource. 
Origin 'http://localhost:3000' is therefore not allowed access. 
If an opaque response serves your needs, set the request's mode to 
'no-cors' to fetch the resource with CORS disabled. 

Chrome的網絡標題標籤說標題是目前和Chrome執行交叉來源PUT請求,就像在飛行前工作一樣。以下是關於OPTIONS請求和響應的說明:

General 
    Request URL:http://localhost:8080/transaction 
    Request Method:OPTIONS 
    Status Code:200 OK 
    Remote Address:[::1]:8080 
Response Headers 
    Access-Control-Allow-Headers:Content-Type 
    Access-Control-Allow-Methods:PUT 
    Access-Control-Allow-Origin:http://localhost:3000 
    Connection:keep-alive 
    Content-Length:0 
    Date:Wed, 22 Feb 2017 14:28:23 GMT 
Request Headers 
    Accept:*/* 
    Accept-Encoding:gzip, deflate, sdch, br 
    Accept-Language:en-US,en;q=0.8 
    Access-Control-Request-Headers: 
    Access-Control-Request-Method:PUT 
    Cache-Control:no-cache 
    Connection:keep-alive 
    DNT:1 
    Host:localhost:8080 
    Origin:http://localhost:3000 
    Pragma:no-cache 
    Referer:http://localhost:3000/ 
    User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36 

任何人都知道我爲什麼收到此消息?

回答

0

好的,可以回答我自己的問題。問題是對PUT的響應中沒有Access-Control-Allow-Origin標頭。

相關問題