English 中文(简体)
谷歌云: 获取图像受到萨赫勒抗旱委员会政策的制约:在请求的资源中,没有接触到Control-Allow-Origin头盔。
原标题:Google Cloud: Access to image has been blocked by CORS policy: No Access-Control-Allow-Origin header is present on the requested resource

我通过云层的Run部署了谷歌云网站。 该网站使用Django和网络包。 这些资源自动装入谷歌云储存库。

然而,当我试图装上网站时,某些资源并没有正确地装上:

Access to image at  https://storage.googleapis.com/<bucket-name>/bcf8ff28514bad926b0c.png  from origin  <URL of my website>  has been blocked by CORS policy: No  Access-Control-Allow-Origin  header is present on the requested resource.

如果我试图通过将URL复制到浏览器中来获得这一请求,那么它会做的是罚款(我可以看到图像)。

通过查阅请求书记官,看看不正确载荷的资源,其<编码>Origin将载于我的网站上的URL,例如https://example.com。 实际装载量不正确的资源在申请负责人中没有<编码>Origin。 此外,这个问题仅出现在 Chrome和Safats上,而没有出现在欧德。 当我看望请求书签人时,原产地实际上被定在<条码>上(https://storage.googleapis.com/(而不是<条码>https://example.com),我认为这是资源负荷正确的原因。

我猜测,解决这一问题有两种办法,尽管我不知道应选择何种解决办法以及如何执行:

  1. Find a way to set the Origin in the Request Header to https://storage.googleapis.com/ on Chrome and Safari.
  2. Change the settings of my Google Cloud Storage bucket so that it accepts request from https://example.com.
最佳回答
问题回答

暂无回答




相关问题
How to fix CORS for Capacitor/Quasar App in a Laravel API

I have an App built on top of Quasar and Capacitor, with an API built on top of Laravel. Everything works well on the dev environment until I build and install the app on my phone, then I keep getting ...

Laravel +Vuejs CORS issue

I am facing a dilemma wit the CORS issue. I have application that is configured as follow: API: https://abc.mydomain.com (laravel) front end: https://subdomain.mydomain.com(VueJS) Both applications ...

Why does CORS not seem to work with POST?

Mozilla s own specification says simple GET or POST should be natively CORS s without preflighting but so far every POST attempt I ve made has resulted in an OPTIONS header going out. When I change ...

热门标签