Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow remote file upload (CORS) #913

Merged
merged 3 commits into from Apr 17, 2016
Merged

Allow remote file upload (CORS) #913

merged 3 commits into from Apr 17, 2016

Conversation

ghost
Copy link

@ghost ghost commented Apr 17, 2016

Implement preflighted requests (OPTIONS) to allow remote files upload (CORS).

@wolfmanjm
Copy link
Contributor

Can you please explain what this is used for, how it is used, and what happens without it?

The code looks fine, however I am not understanding what it is used for, and I am concerned about the significant addition in Flash storage.

Thank you.

@ghost
Copy link
Author

ghost commented Apr 17, 2016

When a remote POST request is made to send a file to the server, the JavaScript XMLHttpRequest() object change the request type to 'OPTIONS' to ensure the request is secure and wait for some headers to validate the request. This PR handle the OPTIONS request and send apropriate header to allow remot file upload via XMLHttpRequest(). Otherwise a client that does not reside on the board can not upload file.

@wolfmanjm wolfmanjm merged commit 804489c into Smoothieware:edge Apr 17, 2016
@dcousens
Copy link

dcousens commented Apr 18, 2016

CORS should only be necessary if your origin is different? Was this for API access?
That doesn't mean "not on the board", it means not on the same URL as the site.

@ghost
Copy link
Author

ghost commented Apr 18, 2016

@dcousens Yes for an API access i am working on : http://lautr3k.github.io/Smoothie-Happy/
If the client is not on the board (hosted on sd card) it is not on the same ip/url.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants