Merge pull request #8681 from backstage/rugvip/assetcache
app-backend: store static assets across deployments and improve caching
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
---
|
||||
'@backstage/create-app': patch
|
||||
---
|
||||
|
||||
Updated the configuration of the `app-backend` plugin to enable the static asset store by passing on `database` from the plugin environment to `createRouter`.
|
||||
|
||||
To apply this change to an existing app, make the following change to `packages/backend/src/plugins/app.ts`:
|
||||
|
||||
```diff
|
||||
export default async function createPlugin({
|
||||
logger,
|
||||
config,
|
||||
+ database,
|
||||
}: PluginEnvironment): Promise<Router> {
|
||||
return await createRouter({
|
||||
logger,
|
||||
config,
|
||||
+ database,
|
||||
appPackageName: 'app',
|
||||
});
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-app-backend': patch
|
||||
---
|
||||
|
||||
Updated the cache control headers for static assets to instruct clients to cache them for 14 days.
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
'@backstage/plugin-app-backend': patch
|
||||
---
|
||||
|
||||
Added a new asset cache that stores static assets from previous deployments in the database. This fixes an issue where users have old browser tabs open and try to lazy-load static assets that no longer exist in the latest version.
|
||||
|
||||
The asset cache is enabled by passing the `database` option to `createRouter`.
|
||||
Reference in New Issue
Block a user