Search code examples
pythongoogle-app-enginecors

How to enable CORS on Google App Engine Python Server?


I am see the following error on Javascript console:

VM31:1 XMLHttpRequest cannot load '<some-url>'. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '<my-url>' is therefore not allowed access.

How do I enable Cross-Origin Resource Sharing with Google App Engine (Python) to access ?


Solution

  • You'll have to use the Access-Control-Allow-Origin http header in your yaml configuration

    handlers:
    - url: /
      ...
      http_headers:
        Access-Control-Allow-Origin: http://my-url
    

    Find more under CORS Support in the docs