How can I work around the same-origin policy to develop AJAX client code for a Google AppEngine site?
-
I'm working with someone who has a Google AppEngine site with a custom API located there. I need to write some AJAX Javascript to interface with the custom API on the site, but I'm getting stonewalled by the same-origin policy. JSONP will be of no use because you can't get an error callback from a failed AJAX request (it doesn't use XMLHTTPRequest). I am using JQuery to make the requests. Apparently Google AppEngine has a terrible caveat that you can't individually upload single files for testing, so I can't fix this problem by developing directly on the API's proper domain. I'm on a MAC and I have heard you can set up some kind of proxy to get around this, I have no idea even where to start with that, and don't want to if I don't absolutely have to. What is the best way to avoid this same-origin policy for development??
-
Answer:
Well the easiest would be to develop locally, running the site in the App Engine launcher on your mac. If that's not possible but you can get the client to edit his code, you could ask him to add a header (see http://enable-cors.org/) : Access-Control-Allow-Origin: *If again that's not possible you could just run your browser with security disabled to debug your code. For Chrome, launch the browser with this command: /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --disable-web-security
Francois Rejete at Quora Visit the source
Related Q & A:
- How can I work on tones on a guitar?
- How can I work in USA or UK?Best solution by Yahoo! Answers
- How can I get around paying extra charges when traveling by train through Italy with a Eurail pass?Best solution by Yahoo! Answers
- How can I turn around the image of a video?Best solution by Yahoo! Answers
- How can I work in a cruiseship?Best solution by wikihow.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.