Skip to content

Instantly share code, notes, and snippets.

@marcusglowe
Created November 2, 2023 15:16
Show Gist options
  • Save marcusglowe/6ad878c231628d4bd87f446fb6608e85 to your computer and use it in GitHub Desktop.
Save marcusglowe/6ad878c231628d4bd87f446fb6608e85 to your computer and use it in GitHub Desktop.
next config for ghost blog hosted at <url>/blog
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