Heroku 附加 Edge CDN 覆盖 Content-Security-Policy 标头

问题描述 投票:0回答:1

我目前通过 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)我将如何解决这个问题?

谢谢!

这是我的 Edge 仪表板:

这是Edge CDN网络请求:

这是默认的 Heroku 网络请求(这个工作正常):

heroku amazon-cloudfront cdn content-security-policy shopify-app
1个回答
0
投票

我也有同样的问题,请问你解决了吗?

© www.soinside.com 2019 - 2024. All rights reserved.