Main issue: Apps are being rejected in review for missing Content-Security-Policy with a frame-ancestors directive that prevents clickjacking. Required value: frame-ancestors https://[shop].myshopify.com https://admin.shopify.com, where [shop] is the current shop domain.
Key clarifications: The header must be present on every response where the app can be framed, including install/auth and post-install pages. It must use the dynamic shop value, not a wildcard.
Tried solutions:
Next.js next.config.js static headers fail due to the dynamic [shop] value.
Server middleware (Koa/Express) sets the header per request using ctx.query.shop or a cookie (shopOrigin). Some used koa-helmet to generate CSP. Concerns were raised about third‑party cookies, but one report says this still passed review.
Alternatives: set header in appRouter for all routes, or in getServerSideProps on index page. PHP implementations set the header on every page.
Recent update: The newest Shopify CLI project template includes built-in middleware that sets the correct CSP for embedded apps (uses shop from query; otherwise sets frame-ancestors ‘none’).
Current status: Mixed results. Some passed review with the middleware approaches; others still face rejections and seek concrete failing URLs. Code snippets and one screenshot are central. Discussion remains open.
And I’m wondering - do these headers have to be present on the installation of the app?
Or are we expected to set them upon redirect to the app for the alternative payment gateway flow. Just wondering where in the order of operations these need to exist.
how can i resolve this issue because that my app was rejected constantly PLz Guaid
The app must set security headers to protect against clickjacking.
Your app must set the proper frame-ancestors content security policy directive to avoid clickjacking attacks. The ‘content-security-policy’ header should set frame-ancestorsHTTPS://[shop].myshopify.comhttps://admin.shopify.com, where [shop] is the shop domain the app is embedded on.
Thanks for Replay
Actually I have made a public app on Shopify partner, when I send that app for review, then this error is there. So do you have any idea about this error?
I am creating a public app and when it was sent for review this is the error which we are facing right now. Can you please help me in resolving it thanks.
And I’m wondering - do these headers have to be present on the installation of the app?
Or are we expected to set them upon redirect to the app for the alternative payment gateway flow. Just wondering where in the order of operations these need to exist.
I had the same issue and what solved that error for me was adding the headers in the next.config file, I did it exatcly using the NextJS documentation here
Where the key is “Content-Security-Policy” and the value is “frame-ancestors https://[shop].myshopify.com https://admin.shopify.com/;”