Created
November 2, 2023 15:16
-
-
Save marcusglowe/6ad878c231628d4bd87f446fb6608e85 to your computer and use it in GitHub Desktop.
next config for ghost blog hosted at <url>/blog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const BLOG_URL = process.env.BLOG_URL ?? 'https://createxyz.ghost.io/blog'; | |
/** | |
* @type {import('next').NextConfig} | |
*/ | |
const nextConfig = { | |
rewrites() { | |
return [ | |
{ | |
source: '/blog/:path*', | |
has: [ | |
{ | |
type: 'header', | |
key: 'Accept', | |
value: 'text/html.*', | |
}, | |
], | |
destination: `${BLOG_URL}/:path*/`, | |
}, | |
{ | |
source: '/blog/:path*', | |
missing: [ | |
{ | |
type: 'header', | |
key: 'Accept', | |
value: 'text/html.*', | |
}, | |
], | |
destination: `${BLOG_URL}/:path*`, | |
}, | |
]; | |
}, | |
headers() { | |
return [ | |
{ | |
source: '/blog/:path*', | |
headers: [{ key: 'x-forwarded-host', value: 'www.create.xyz' }], | |
}, | |
]; | |
}, | |
}; | |
module.exports = nextConfig; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment