diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index ccf856c2..1c2dbd80 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -34,11 +34,7 @@ jobs: CONTEXT: deploy-preview NETLIFY: true run: | - mkdir -p ./static - cp ./custom-headers/_previewHeaders ./static/_headers yarn build - ls -la ./build/_headers || echo "Headers file not found in build" - cat ./build/_headers || echo "Cannot read headers file" - name: Deploy to Netlify uses: jsmrcaga/action-netlify-deploy@v2.0.0 diff --git a/custom-headers/_productionHeaders b/custom-headers/_productionHeaders new file mode 100644 index 00000000..aecb7343 --- /dev/null +++ b/custom-headers/_productionHeaders @@ -0,0 +1,14 @@ +/* + 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; + +/static/* + Cache-Control: public, max-age=31536000, immutable + +*.js + Cache-Control: public, max-age=31536000, immutable + +*.css + Cache-Control: public, max-age=31536000, immutable \ No newline at end of file diff --git a/netlify.toml b/netlify.toml index a4d42b8c..e14829a3 100644 --- a/netlify.toml +++ b/netlify.toml @@ -635,33 +635,8 @@ to = "/enterprise/" status = 301 force = true +[context.production] +command = "npm run build && cp ./custom-headers/_productionHeaders ./build/_headers" -[[headers]] -for = "/*" -[headers.values] -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" - -[[redirects]] -from = "/docs/*" -to = "/:splat" -status = 200 -force = true -conditions = {Context = "deploy-preview"} +[context.deploy-preview] +command = "yarn build && cp ./custom-headers/_previewHeaders ./build/_headers" \ No newline at end of file diff --git a/static/_headers b/static/_headers deleted file mode 100644 index f08a605f..00000000 --- a/static/_headers +++ /dev/null @@ -1,29 +0,0 @@ -/*/*.html - Cache-Control: public, max-age=60 - Content-Security-Policy: default-src 'self'; object-src 'none'; style-src 'self' 'unsafe-inline'; script-src 'self'; img-src 'self' data:; connect-src 'self'; font-src 'self' https://fonts.gstatic.com data:; manifest-src 'self'; prefetch-src 'self'; media-src 'self' data:; worker-src 'self'; frame-ancestors 'none'; base-uri 'self'; form-action 'self'; - X-Frame-Options: DENY - X-XSS-Protection: 1; mode=block - X-Content-Type-Options: nosniff - Referrer-Policy: strict-origin-when-cross-origin - Permissions-Policy: camera=(), geolocation=(), microphone=() - Strict-Transport-Security: max-age=15768000 - -# Cache JavaScript, CSS, SVG, TXT, and WebP files for a year -/*.js - Cache-Control: public, max-age=31536000 -/*.txt - Cache-Control: public, max-age=31536000 -/*.webp - Cache-Control: public, max-age=31536000 - -# Cache images in the /images/ folder for 2 days -/images/* - Cache-Control: public, max-age=172800 - -# Cache the web manifest for 2 days -/manifest.webmanifest - Cache-Control: public, max-age=172800 - -# Revalidated sw on every request -/sw.js - Cache-Control: max-age=0, must-revalidate, public