Repository navigation
Replies: 2 comments
|
Had the same question on 3.10.3. Hashed files under Setting the header after // server/modern.server.ts (needs @modern-js/server-runtime)
import { defineServerConfig, type MiddlewareHandler } from '@modern-js/server-runtime';
const immutableAssets: MiddlewareHandler = async (c, next) => {
await next();
c.res.headers.set('Cache-Control', 'public, max-age=31536000, immutable');
};
export default defineServerConfig({
middlewares: [{ name: 'immutable-assets', path: '/static/*', handler: immutableAssets }],
});If it looks like A default for hashed assets, or a note in the deploy guide, would probably save others the search. |
|
This is built in now. #9100 added It's merged but not released yet, so until the next release the middleware above is still the way to go. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hey everyone!
I use Modern.js with Node.js environment and faced to the task when I need to add Cache-Control into HTTP responses with specific values.
How I can set them?
The common:
Doesn't work. As I understand the main idea to find any workaround to http-server from
modern deployartifacts.Thank you!
All reactions