We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8b85801 commit 4cc4438Copy full SHA for 4cc4438
examples/cms-contentful/pages/api/preview.js
@@ -22,10 +22,12 @@ export default async function preview(req, res) {
22
// We don't redirect to req.query.slug as that might lead to open redirect vulnerabilities
23
// res.writeHead(307, { Location: `/posts/${post.slug}` })
24
const url = `/posts/${post.slug}`
25
+ res.setHeader('Content-Type', 'text/html');
26
res.write(
27
`<!DOCTYPE html><html><head><meta http-equiv="Refresh" content="0; url=${url}" />
28
<script>window.location.href = '${url}'</script>
- </head>`
29
+ </head>
30
+ </html>`
31
)
32
res.end()
33
}
0 commit comments