Skip to content

Commit

Permalink
better and cleaner caching
Browse files Browse the repository at this point in the history
  • Loading branch information
goodroot committed Dec 12, 2024
1 parent 559c74a commit 5836072
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 24 deletions.
24 changes: 1 addition & 23 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const config = {
baseUrlIssueBanner: false,
favicon: "/images/favicon.webp",
organizationName: "QuestDB",
staticDirectories: ['assets', 'images', 'static'],
staticDirectories: ['static'],
projectName: "questdb",
customFields,
onBrokenLinks: "warn",
Expand Down Expand Up @@ -83,28 +83,6 @@ const config = {
],
},
],
function (context, options) {
return {
name: 'development-redirects',
configureWebpack(config, isServer, utils) {
if (process.env.NODE_ENV === 'development') {
return {
devServer: {
onBeforeSetupMiddleware: function (devServer) {
devServer.app.get('*', function (req, res, next) {
// If path doesn't start with /docs, redirect to Next.js
if (!req.path.startsWith('/docs/')) {
return res.redirect(`http://localhost:3000${req.path}`)
}
next()
})
}
}
}
}
}
}
}
].filter(Boolean),

themeConfig: {
Expand Down
31 changes: 30 additions & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
[[plugins]]
package = "netlify-plugin-cache"
[plugins.inputs]
paths = ["node_modules/.cache"]
paths = [
"node_modules/.cache",
".cache",
".docusaurus",
"build",
"node_modules"
]

[build]
command = "npm run build"
publish = "build"

[build.environment]
NODE_VERSION = "18"
NODE_OPTIONS = "--max_old_space_size=4096"

[[redirects]]
from = "/docs/reference/sql/backup/"
Expand Down Expand Up @@ -637,3 +651,18 @@ X-Frame-Options = "SAMEORIGIN"
X-XSS-Protection = "0"
X-Content-Type-Options = "nosniff"
Content-Security-Policy = "frame-src 'self' app.netlify.com *.demo.questdb.io *.questdb.io www.youtube.com www.slideshare.net forms.hsforms.com;"

[[headers]]
for = "/static/*"
[headers.values]
Cache-Control = "public, max-age=31536000, immutable"

[[headers]]
for = "*.js"
[headers.values]
Cache-Control = "public, max-age=31536000, immutable"

[[headers]]
for = "*.css"
[headers.values]
Cache-Control = "public, max-age=31536000, immutable"

0 comments on commit 5836072

Please sign in to comment.