Skip to content

Commit

Permalink
refactor: generates headers and redirects with netlify plugin (#2269)
Browse files Browse the repository at this point in the history
Cloudflare does support _headers and _redirects file format.

This allows to version our custom headers and drop the Cloudflare Worker reverse proxy.

Depends-On: #2268
Depends-On: #2270
  • Loading branch information
sileht authored Sep 26, 2023
1 parent 97b2512 commit 98d4749
Show file tree
Hide file tree
Showing 3 changed files with 2,989 additions and 30,834 deletions.
27 changes: 22 additions & 5 deletions gatsby-config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,37 @@ const plugins = [
plugins: gatsbyRemarkPlugins
}
},
];

plugins.push(
'gatsby-plugin-local-docs', // local plugin
{
resolve: 'gatsby-source-filesystem',
options: {
name: '/',
path: 'src/content'
}
},
{
resolve: `gatsby-plugin-netlify`,
options: {
headers: {
"/*": [
"Cache-control: public, max-age=600, no-transform",
"Content-Security-Policy: default-src 'self' https:; " +
"frame-ancestors 'none'; " +
"script-src 'self' https: 'unsafe-inline'; " +
"style-src 'self' 'unsafe-inline' https:; " +
"img-src 'self' data: https:; " +
"manifest-src 'self' data:",
]
},
allPageHeaders: [],
mergeSecurityHeaders: true,
mergeCachingHeaders: true,
transformHeaders: (headers, path) => headers,
generateMatchPathRewrites: true,
},
}
);
];

plugins.push('gatsby-plugin-client-side-redirect')

const config = {
pathPrefix: '/' + process.env.PR_NUMBER + '/docs',
Expand Down
Loading

0 comments on commit 98d4749

Please sign in to comment.