filesListFolderLongpoll() causes CORS preflight error
See original GitHub issueXMLHttpRequest cannot load https://notify.dropboxapi.com/2/files/list_folder/longpoll.
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. The response had HTTP status code 501.
Tested on macOS Chrome (54.0.2840.71 (64-bit)), Safari (10.0.1 (11602.2.14.0.7)) & Firefox (49.0.2).
This seems unrelated to #42 (or associated issues) because domain is notify.dropboxapi.com not api.dropboxapi.com.
Can also be reproduced with following XHR request:
var xhr = new XMLHttpRequest();
xhr.open("POST", "https://notify.dropboxapi.com/2/files/list_folder/longpoll");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(JSON.stringify({cursor: "AAG9UMjHQxjlfNX_rOPsVO0W27HIkPlD-xBu0rETcMhuWsprxpgE-94NVr29SIgJfGlFokxPbJSuTG6ryGD01d_amqnijqi0fcXp2cdkYeq63krcuD9jKVeU4kbBNSLfXzswS-NXCJJF1IA_AUeL_h4ZKFyuJIuVRQNodUu8EOo0Vw"}));
// I assume you'll need to provide a cursor value that matches your own account
It seems it is the Content-Type “application/json” header that is triggering the CORS prefilght. The suggested Content-Type “text/plain;charset=dropbox-cors-hack” hack doesn’t work as all 3 browsers I tested rewrite to “text/plain” which result in a 400 Bad request.
Issue Analytics
- State:
- Created 7 years ago
- Comments:29 (13 by maintainers)
Top Results From Across the Web
Preflight, or CORS error, on every request - Stack Overflow
The reason it's being flagged for preflight is the extra headers you are sending. GET requests do not have to use a preflight...
Read more >Chapter 4. Handling preflight requests - CORS in Action
A preflight could be successful, but the request could still fail for many reasons, such as a file not found, an authorization error,...
Read more >CORS errors and how to solve them - Topcoder
Open a network tab in your console. In the response header look for the Access-Control-Allow-Origin header. If it does not exist then add...
Read more >3 Ways to Fix the CORS Error — and How the Access-Control ...
Fix one: install the Allow-Control-Allow-Origin plugin. The quickest fix you can make is to install the moesif CORS extension .
Read more >Update Post throwing CORS Preflight error against
Update Post throwing CORS Preflight error against ArcGis Online Rest Endpoint ... parameter which I assume is what is causing the error.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This should be working now. Please let us know if you’re still seeing any issues.
Thanks! We’ll look into it.