I would like to handle large file uploads to App Engine (Blobstore -> Google Cloud Storage) in my AJAX focused webapp hosted on the same App Engine domain.
From the browser javascript client I call the App Engine server and receive a URL in response (created from 'create_upload_url') but I am stuck with how to take my file and upload it to that URL without getting a cross domain error. I appear to be unable to set CORS headers on the Blobstore receiver and the domain doesn't match the domain my app is serving from ('create_upload_url' appends '1-dot-' to the prefix of the subdomain).
Have any ideas or experience with this?
One idea: since "1-dot-" prefix seems to be just referring to a particular deployed version, perhaps if I parse the url and remove any prefix like that to make the domains the same and submit to that url to avoid a domain mis-match.
Thanks for bringing this up. This is due to the current nature of request handling and we are considering it a bug while brainstorming to figure out the best way forward.
Currently, if a user makes a request to
https://myappid.appspot.com/_ah/api/myApi/v1/methodpath
then it is routed by Google's API Infrastructure to
https://version-dot-myappid.appspot.com/_ah/spi/MyApi.Method
where version
is the default version for the myappid
application.
UPDATE: A previously suggested workaround a la How do I parse a URL into hostname and path in javascript? has been shown not to work. This is because the App Engine instance that calls create_upload_url
"knows" which version/host it is and so changing this causes errors.