-
-
Save softplus/173d1c96685edb8f05191ab5edafd78f to your computer and use it in GitHub Desktop.
Sample firebase.json configuration with common security & caching headers
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
{ | |
"hosting": { | |
"public": "public", | |
"ignore": [ | |
"firebase.json", | |
"**/.*", | |
"**/node_modules/**" | |
], | |
"headers": [ { | |
"source": "**/*.@(eot|otf|ttf|ttc|woff|font.css|woff2)", | |
"headers": [ { | |
"key": "Access-Control-Allow-Origin", | |
"value": "*" | |
} ] | |
}, { | |
"source": "**/*.@(jpg|jpeg|gif|png|webp|ttf|woff|woff2|ico|zip)", | |
"headers": [ { | |
"key": "Cache-Control", | |
"value": "max-age=604800" | |
} ] | |
}, { | |
"source": "**/*.@(css|js|json)", | |
"headers": [ { | |
"key": "Cache-Control", | |
"value": "max-age=604800" | |
} ] | |
}, { | |
"source": "404.html", | |
"headers": [ { | |
"key": "Cache-Control", | |
"value": "max-age=604800" | |
} ] | |
}, | |
{ | |
"source": "**", | |
"headers": [ { | |
"key": "X-Content-Type-Options", | |
"value": "nosniff" | |
}, { | |
"key": "X-Frame-Options", | |
"value": "SAMEORIGIN" | |
}, { | |
"key": "X-XSS-Protection", | |
"value": "1; mode=block" | |
}, { | |
"key": "Content-Security-Policy", | |
"value": "default-src 'self'; child-src 'none'; script-src https://cdnjs.cloudflare.com 'unsafe-inline'; style-src 'self' 'unsafe-inline'" | |
}, { | |
"key": "Referrer-Policy", | |
"value": "origin-when-cross-origin" | |
} | |
] | |
} ] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment