问题描述
我的Django网站通过Nginx托管在digitalocean ubuntu 16.04中.
My Django website is hosting in digitalocean ubuntu 16.04 with Nginx.
我在此处设置了digitalocean CORS配置 https://www. digitalocean.com/docs/spaces/how-to/cors/我在来源"中添加了自己的domian名称,选中了允许的方法"中的所有选项,我唯一没有做的就是添加标题在允许的标题"中,因为我不知道要添加什么.
I have setup digitalocean CORS Configurations as here https://www.digitalocean.com/docs/spaces/how-to/cors/ I added my domian name in the 'origin',checked all the options in 'Allowed Methods',the only thing I haven't done is add headers in 'Alowed Headers' because I have no idea what to add.
当我使用digitalocean Spaces(一种基于服务且与Amazon S3非常相似的服务)作为我的静态和媒体文件存储时.所请求的资源上没有'Access-Control-Allow-Origin'标头错误:
When I use digitalocean Spaces(a service based on and very similar as Amazon S3) as my static and media file storage.There is No 'Access-Control-Allow-Origin' header is present on the requested resource error:
我尝试使用django-cors-headers,但收到了:
I tried to use django-cors-headers,but I received:
因此必须将其卸载.
任何朋友有任何想法吗?非常感谢!
Any friend have any idea?Thank you so much!
推荐答案
您需要在Digital ocean而不是在网站上设置CORS.检查以下内容: digitalocean.com/docs/spaces/how-to/cors
You need to setup CORS at Digital ocean, not on your website. Check this: digitalocean.com/docs/spaces/how-to/cors
这篇关于Django digitalocean Spaces所请求的资源上没有"Access-Control-Allow-Origin"标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!