dropbox / dropbox/dropbox-sdk-js

CORS preflights on every call

Open
#111 10 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
970
Forks
353
Avg merge
9h 3m
Merged PRs (30d)
2

Description

It looks like every call the SDK makes requires a CORS preflight - very inefficient.
On [this page](https://www.hitchhq.com/dropbox/activities/57b2d630a43e3fb71ba61758)
I found this:
Browser-based JavaScript and CORS pre-flight requests

When browser-based JavaScript code makes a cross-site HTTP request, the browser must sometimes send a "pre-flight" check to make sure the server allows cross-site requests. You can avoid the extra round-trip by ensuring your request meets the CORS definition of a "simple cross-site request".
•·Use URL parameters arg and authorization instead of HTTP headers Dropbox-API-Arg and Authorization.
•·Set the Content-Type to "text/plain; charset=dropbox-cors-hack" instead of "application/json" or "application/octet-stream".
•·Always set the URL parameter reject_cors_preflight=true. This makes it easier to catch cases where your code is unintentionally triggering a pre-flight check.

I hop the above helps.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.