1

in the context, I've an application that can access via 2 different URL like below

  • backoffice.*

  • backoffice-mfe.*

Everything will be fine if I stick and use only one domain in whole time, but the issue appear whenever I start to change between them

Let's say Im in backoffice.* and try to get enter the link of backoffice-mfe.* then it will happen

Access to fetch at 'https://storage.googleapis.com/import-map-deployer-staging/manabie/syllabus/20230821081002.0c032eb4/syllabus-init-module/index.js' from origin 'https://backoffice.staging.manabie.io' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value 'https://backoffice-mfe.staging.manabie.io' that is not equal to the supplied origin. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

enter image description here

I already tried to set the origin to *, and origin to access backoffice.* and backoffice-mfe.*.

Although, the Vary header already set Origin to don't get wrong cache for given URLs

But the issue still happens

Vary: Origin and Access-Control-Allow-Origin is backoffice-mfe

enter image description here

Has anyone encountered a similar situation? Thank you in advance for your help.

I'd like to fix above issue

Thu Vo
  • 53
  • 2
  • This sounds like a caching issue. Are you by any chance using Cloudflare? I believe [Cloudflare's free tier doesn't honour the `Vary` header](https://community.cloudflare.com/t/cloudflare-cdn-cache-to-support-http-vary-header/160802), which would explain the issue you're experiencing. – jub0bs Aug 21 '23 at 13:36
  • Also, please do not ask the same question multiple times. Delete either this one or [that earlier one](https://stackoverflow.com/questions/76940637/set-vary-headers-for-google-bucket-storage-and-public-url-access). – jub0bs Aug 21 '23 at 13:46
  • @jub0bs I don't use Cloudflare at this. yeah, I think it's related to caching, since I tried to turn on `disable cache` in DevTools and It works well – Thu Vo Aug 22 '23 at 03:08

0 Answers0