Servers that supports CORS?

大城市里の小女人 提交于 2019-12-07 04:07:10

问题


I wonder if there are many servers that are supporting CORS?


回答1:


To make your web server support CORS, it is as easy as making it return another header.

For example, in Apache2, simply add this line to your applicable conf file:

Header set Access-Control-Allow-Origin "*"

To be more secure (or if you don't have access to your server's conf file) you might want to NOT add this header in your server, but only add it with your server-side code when you really want it there.

For example in PHP you could do this: (untested)

<? header('Access-Control-Allow-Origin "*"'); ?>




回答2:


Tomcat users can use the CORS Filter




回答3:


You can find here a simple implementation of a Python 2.7 server supporting CORS



来源:https://stackoverflow.com/questions/4952838/servers-that-supports-cors

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!