Debugging embeddable on amplify

This commit is contained in:
Julien Nahum 2024-01-12 12:00:01 +01:00
parent 4115b44f1d
commit a0513c4458
1 changed files with 5 additions and 1 deletions

View File

@ -1,10 +1,14 @@
export default defineNitroPlugin(nitroApp => {
nitroApp.hooks.hook('render:response', (response, { event }) => {
const routePath = event.node?.req?.url || event.node?.req?.originalUrl
console.log(routePath, !routePath.startsWith('/forms/'))
// const routePath= event.context.params._
if (routePath && !routePath.startsWith('forms/')) {
if (routePath && !routePath.startsWith('/forms/')) {
console.log(response, event)
// Only allow embedding of forms
response.headers['X-Frame-Options'] = 'sameorigin'
}
delete response.headers['x-powered-by']
})
})