如何在Google App Engine Python服务器上启用CORS? [英] How to enable CORS on Google App Engine Python Server?

查看:117
本文介绍了如何在Google App Engine Python服务器上启用CORS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  VM31:1 XMLHttpRequest无法加载'< some-url> 。请求的资源上没有Access-Control-Allow-Origin标题。原因'< my-url>'因此不被允许访问。 

如何使用Google App Engine(Python)启用跨源资源共享? Access-Control-Allow-Origin

解决方案你的yaml配置中的http header

 处理程序:
- url:/
...
http_headers:
Access-Control-Allow-Origin:http:// my-url

文档中的CORS支持中查找更多信息


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 ?

解决方案

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

这篇关于如何在Google App Engine Python服务器上启用CORS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆