Preflight response and CORS

41 views
Skip to first unread message

Edan W

unread,
Apr 24, 2016, 5:01:31 AM4/24/16
to Neo4j
I am having trouble connecting to neo4j from my Angular2 app due to a CORS issue. I've posted the details on Stack Overflow.  

Matteo's answer suggests that Neo4j is not sending the correct headers in response to the client. It should detect the OPTIONS type, and send status 200 with appropriate access-control parameters. I'm using the Neo4j-Typescript package and a Webpack dev-server to access neo4j 2.3.3. Could this be a problem with the Neo4j REST Api?

Thanks!



Mark Angrish

unread,
May 8, 2016, 9:04:47 PM5/8/16
to Neo4j
Hi Edan,

Are you actually using a NodeJs driver to connect to Neo4j or are you using your own HTTP calls to call the database?

I highly recommend you use the NodeJs driver for 2.3.3: http://neo4j.com/developer/javascript/

If you upgrade to the current version of Neo4j (3.0) you can use the official Neo4j NodeJs driver: http://neo4j.com/docs/pdf/neo4j-developer-manual-3.0-javascript.pdf

If you want to continue making calls without a driver then I would double check that you are sending the Authorization token in the header (from memory it's just base64 encoding of the username and password) and that you have followed the authentication protocol (http://neo4j.com/docs/developer-manual/current/#rest-api-security).  From what I read on your stack overflow it doesn't look like a CORS problem (angular is calling your express server which calls neo4j.. if angular is calling your DB you might want to revisit your architecture or look at something like meteor.js).

::mark

Edan W

unread,
May 23, 2016, 8:37:15 AM5/23/16
to Neo4j
Hi Mark

Thanks for your help. I will give the official Neo4j 3.0 NodeJs driver a try, but I'm not sure if I can use it without typescript definitions for use in my Angular 2 app?
I'm using the Neo4j-Typescript package which looks as though it implements the RESTful API for Neo4j > 2.3.x. 
Reply all
Reply to author
Forward
0 new messages