Where is the correct place to enable CORS?

后端 未结 2 1254
庸人自扰
庸人自扰 2021-01-25 03:03

I\'m using Spyne (the example \"hello world\" code) to make a webservice that produces some json data and then I\'m trying to consume this data in javascript code i

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-25 03:35

    No need to add any client side code.

    You simply need to add the following to the header of the response sent by the server:

    Access-Control-Allow-Origin: *

    See http://enable-cors.org/server.html for more info for the various server setups. Not familiar with Spyne but this may help

    http://spyne.io/docs/2.10/manual/06_metadata.html#protocol-headers

提交回复
热议问题