HTTPUpdateServer Allow external POSTS (CORS) #6824
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This update is to allow the ESP8266HTTPUpdateServer to receive a cross cors POST update from an external domain. This is needed for web based apps / mobile apps to flash using a standard AJAX post from an external device.
Code Used (in case anyone else wants to use Ajax to POST a flash update)
Note: Using XHR direct for blob, less code then jQuery, then jQuery for standard post. Just console the reply to keep it simple for reuse.
Security Notes:
Even without CORS headers set, anyone can update remotely using CURL or a program like PostMan. For that reason, allowing cross domain access in this way not going to open up security options for a real hacker that wouldn't be using a web browser to hack your device.
If desired, this can be added as an optional feature, but due to the above note - didn't see a need as it doesn't really do anything. Using real security is the only way to really secure your system from hacker update (along with physical security of course).
(open for comment / feedback on that assertion).