我正在嘗試使用Backbone.js模型來訪問Neo4j內容。我不明白爲什麼下面的通信失敗跨域檢查:對Neo4j的Ajax請求失敗CORE
首先OPTIONS請求:
Request URL:http://localhost:7474/db/data/cypher
Request Method:OPTIONS
Status Code:204 No Content
Request Headers
Accept:*/*
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Access-Control-Request-Headers:origin, content-type, accept
Access-Control-Request-Method:POST
Connection:keep-alive
Host:localhost:7474
Origin:http://localhost:3000
Referer:http://localhost:3000/test/
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.47 Safari/536.11
Response Headers
Access-Control-Allow-Headers:origin, content-type, accept
Access-Control-Allow-Methods:POST
Access-Control-Allow-Origin:*
Allow:OPTIONS,POST
Server:Jetty(6.1.25)
然後POST請求:
Request URL:http://localhost:7474/db/data/cypher
Request Headers
Accept:application/json, text/javascript, */*; q=0.01
Content-Type:application/json
Origin:http://localhost:3000
Referer:http://localhost:3000/test/
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.47 Safari/536.11
Request Payload
start n=node(0) match n-[:hasClass]->c where c.className=Collection return c
我也得到控制檯錯誤:
OPTIONS http://localhost:7474/db/data/cypher 204 (No Content) jquery-1.7.2.min.js:4
XMLHttpRequest cannot load http://localhost:7474/db/data/cypher. Origin http://localhost:3000 is not allowed by Access-Control-Allow-Origin.
據我所知,請求應該被允許,因爲預檢請求sai d Access-Control-Allow-Origin:*。有什麼建議麼?有什麼我失蹤? 謝謝!