Cloud Storage - No 'Access-Control-Allow-Origin' header is present on the requested resource for AngularJS view

后端 未结 5 1508
名媛妹妹
名媛妹妹 2021-02-15 05:45

According to Chrome dev tools, my requests to get my html partials have the origin header https://site-name-here.com and request header GET.
I have the following JSON file s

5条回答
  •  北荒
    北荒 (楼主)
    2021-02-15 06:43

    Just to support @Idcmp's answer, the CORS policy does take a while before taking full effect (this is not documented tho). I've spent ~2 hours trying to figure out why I'm still getting CORS error in browser even though I use the below policy (which is highly NOT recommended, but it's fine for my personal testing project).

    {
        "cors": [
          {
            "origin": [
              "*"
            ],
            "method": [
              "*"
            ],
            "responseHeader": [
              "*"
            ],
            "maxAgeSeconds": 3600
          }
        ]
    }  
    

    ps Take a coffee break after applying a new CORS policy, you definitely deserve it

提交回复
热议问题