0xffff-one / flarum-0x

🔧 Customized Flarum for the 0xFFFF Community.
https://0xffff.one
MIT License
45 stars 5 forks source link

CORS cache error after switch avatar storage to Cloudflare R2 #45

Closed zgq354 closed 1 year ago

zgq354 commented 1 year ago

At user profile page, there are some code works to calculating the main color of avatar and apply to user's background color.

After we migrate the avatar storage to Cloudflare R2, when cache is not disabled, it shows error:

image image

when we disable the cache in Dev tools, it will back to normal

image

It is because some issue about Vary: origin header on Cloudflare R2 / S3, the CORS request and non-CORS request hit the same browser cache instance.

more detail: https://zhuanlan.zhihu.com/p/38972475

zgq354 commented 1 year ago

fixed.