User change a plan getting "refuse to display in a frame because it set 'X-Frame-Options' to 'deny'"

89 3 7

Hello, I'm working on a Shopify marketing widget app. I got almost everything done except some weird issues when users changing the plan.

Currently, users have no problem installing the app after approve the free plan during install to use the app. 

The problem comes when users later attempt to change the plan. It gets " "refuse to display in a frame ...<URL>... because it set 'X-Frame-Options' to 'deny'".

On the pricing table each has a link that goes to a my app URL in this form

https:// <myawesomeapp>.com/shopify/add_plan/standard


..then app crashes with the error message in the browser console with 

Refused to display 'https://<sampleshpify-store>' in a frame because it set 'X-Frame-Options' to 'deny'.


I've tried to add X-Frame-Options "samesite" to Apache security.conf. No help.

I understand the browser stopped the webpage from displaying due to the X-Frame-Options settings as a security measure. But I have no idea how to get around this because the changing plan had come from the pricing table in the app website (e.g., then redirect to Shopify, all inside an iframe. 

I felt it has probably some fundamental architectural issues with my approach as I'm still new to Shopify app development (1 month into it).


Try the free Sales Popup Maker
89 3 7

This is an accepted solution.

Base on an older discussion, I got around the X-Frame-Option limitation by using the client-side redirect that forces the top parent window to go to the confirmation url.

$confirmation_client_load = <<< CONFIRMATION_CLIENT_LOAD
<body onload="onLoadDocument()">
<script type="text/javascript">
function onLoadDocument() {
console.log('{$plan['confirmation_url']}'); = '{$plan['confirmation_url']}';
echo $confirmation_client_load;


Not sure if there's a more elegant solution, but it works for me for now.

Try the free Sales Popup Maker