我目前通过 Heroku 为我的 Shopify 应用程序提供服务。 由于 Shopify 应用程序是在商家后台的 iframe 内加载的,因此要求之一是正确设置
Content-Security-Policy
标头。 frame-ancestors
值必须设置为商店 url。
我将 Edge CDN 添加到我的 Heroku 实例中以缩短加载时间。实施似乎效果很好。
但是当我将应用程序 URL 更改为新的 cloudfront URL 时,该应用程序未在 Shopify 后台加载。
检查标题时,显示
Content-Security-Policy: frame-ancestors 'none';
控制台显示:
Refused to frame 'https://d247hdgomt4lwm.cloudfront.net/' because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'none'".
直接从 url 加载它,相同的标头将被设置为 i.e.
Content-Security-Policy: frame-ancestors https://better-bullets.myshopify.com https://admin.shopify.com https://*.spin.dev;
有谁知道a)为什么标头被覆盖以及b)我将如何解决这个问题?
谢谢!
我也有同样的问题,请问你解决了吗?