Add custom domain support

This commit is contained in:
Julien Nahum
2024-01-12 15:43:28 +01:00
parent a0513c4458
commit ea7041be28
6 changed files with 108 additions and 18 deletions

View File

@@ -1,10 +1,8 @@
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/')) {
console.log(response, event)
// Only allow embedding of forms
response.headers['X-Frame-Options'] = 'sameorigin'
}