Skip to main content

I learned that you can have a preview into MC with a Custom View.

I saw this on a post on linkedIn:

And I naturally tried it, but got an exception:

 

Does any of you know where do I need to configure to support iframes from a different domain?

 

If not answer I’ll create a support ticket...

 

Regards,

Obed
 

 

@Obed Murillo did you followed the configuration properties, namely https://docs.commercetools.com/merchant-center-customizations/api-reference/custom-view-config#envproductionurl ?


Yes I did, but still no luck, according to the AI assistant this is not possible… :(


@Obed Murillo would you like me to get in touch with the support team?


Hey @Obed Murillo ,
I guess what you are looking for is:
 

headers: {
csp: {
'connect-src': :
'*.frontend.site',
],
'frame-src': :
'*.frontend.site',
],
}
},

 

as described here: https://docs.commercetools.com/merchant-center-customizations/api-reference/custom-view-config#headerscsp

Does that help?


Thanks @Philipp Hofmann !

I think this is what I was missing.

Let me try and I’ll get back with you!

Regards,

Obed


Thanks for the help @Philipp Hofmann ,

I had that setting set, but was still failing with the same error, the issue was on the site I was trying to add as preview, it was having the following setting:

async headers() {
return
{
// This will set the X-Frame-Options header to "SAMEORIGIN" for all pages
source: '/:path*',
headers:
{
key: 'X-Frame-Options',
value: 'SAMEORIGIN',
},
],
},
];
}

So I changed it to be as follows:

async headers() {
return
{
// This will set the X-Frame-Options header
source: '/:path*',
headers:
{
key: 'X-Frame-Options',
value: 'ALLOW-FROM https://mc.us-central1.gcp.commercetools.com',
},
],
},
];
}

Good thing we learned that is possible to add a preview on MC :D

Thank you All!

 


Really cool. What is it that you are building? An integrated preview as shown in the screenshot in your first post?


@Philipp Hofmann 

This was just a POC to see the custom views in action.

But yes is a preview of the site we are building

Sorry for the late response.

Regards,

Obed


Reply