Open tomjamescn opened 4 years ago
很好用的数据,感谢米大。
不知道跨域header字段能否支持一下。
复现流程:
curl -vvv -H "Origin: http://example.com" -X POST -d '{"api_name": "top10_floatholders", "token": "hahahahahah", "params": {"ts_code":"600185.SH", "end_date":"20200508"}, "fields": "ann_date,end_date,holder_name,hold_amount"}' http://api.tushare.pro > /dev/null
输出:
* TCP_NODELAY set * Connected to api.tushare.pro (103.235.227.230) port 80 (#0) > POST / HTTP/1.1 > Host: api.tushare.pro > User-Agent: curl/7.64.1 > Accept: */* > Origin: http://example.com > Content-Length: 171 > Content-Type: application/x-www-form-urlencoded > } [171 bytes data] * upload completely sent off: 171 out of 171 bytes < HTTP/1.1 200 OK < Server: nginx/1.16.1 < Date: Sat, 06 Jun 2020 03:29:26 GMT < Content-Type: application/json; charset=UTF-8 < Content-Length: 171 < Connection: keep-alive
返回的header中没有Access-Control-Allow-Origin字段。如果是在浏览器中请求api,会导致跨域失败。
如果可以,麻烦支持一下跨域: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
tushare ID: 370310
安全考虑,不允许跨域请求的!
问下具体什么样的场景需要跨域访问呢?
很好用的数据,感谢米大。
不知道跨域header字段能否支持一下。
复现流程:
输出:
返回的header中没有Access-Control-Allow-Origin字段。如果是在浏览器中请求api,会导致跨域失败。
如果可以,麻烦支持一下跨域: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
tushare ID: 370310