build(docs-infra): improve caching configuration for Firebase hosting (#28785)

This will hopefully improve(/fix?) the errors discussed in #28114.
See there for a more detailed discussion.

PR Close #28785
This commit is contained in:
George Kalpakas 2019-02-17 17:21:44 +02:00 committed by Igor Minar
parent 6788d86709
commit 80c7aff5cc
2 changed files with 20 additions and 5 deletions

2
aio/.gitignore vendored
View File

@ -26,11 +26,13 @@
!.vscode/extensions.json !.vscode/extensions.json
# misc # misc
/.firebase/
/.sass-cache /.sass-cache
/connect.lock /connect.lock
/coverage /coverage
/libpeerconnection.log /libpeerconnection.log
debug.log debug.log
firebase-debug.log
npm-debug.log npm-debug.log
testem.log testem.log
/typings /typings

View File

@ -120,12 +120,25 @@
], ],
"headers": [ "headers": [
{ {
"source": "/", // All paths (URLs without a file extension).
"source": "**/!(*.*)",
"headers": [ "headers": [
{ {"key": "Cache-Control", "value": "no-cache"},
"key": "Link", {"key": "Link", "value": "</generated/navigation.json>;rel=preload;as=fetch,</generated/docs/index.json>;rel=preload;as=fetch"}
"value": "</generated/navigation.json>;rel=preload;as=fetch,</generated/docs/index.json>;rel=preload;as=fetch" ]
} },
{
// Images, fonts, (non-hashed) CSS/JS files.
"source": "**/*.@(gif|jpg|jpeg|png|svg|webp|js|css|eot|otf|ttf|ttc|woff|woff2)",
"headers": [
{"key": "Cache-Control", "value": "max-age=86400"} // 1 day
]
},
{
// Hashed CSS/JS files...
"source": "**/*.+([0-9a-f]).@(css|js)",
"headers": [
{"key": "Cache-Control", "value": "max-age=2592000"} // 30 days
] ]
} }
] ]