Fix URL for embeddable middleware
This commit is contained in:
parent
5d78fc67c6
commit
4115b44f1d
|
@ -1,7 +1,8 @@
|
||||||
export default defineNitroPlugin(nitroApp => {
|
export default defineNitroPlugin(nitroApp => {
|
||||||
nitroApp.hooks.hook('render:response', (response, { event }) => {
|
nitroApp.hooks.hook('render:response', (response, { event }) => {
|
||||||
const routePath= event.context.params._
|
const routePath = event.node?.req?.url || event.node?.req?.originalUrl
|
||||||
if (!routePath.startsWith('forms/')) {
|
// const routePath= event.context.params._
|
||||||
|
if (routePath && !routePath.startsWith('forms/')) {
|
||||||
// Only allow embedding of forms
|
// Only allow embedding of forms
|
||||||
response.headers['X-Frame-Options'] = 'sameorigin'
|
response.headers['X-Frame-Options'] = 'sameorigin'
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue