Skip to content

Commit efee061

Browse files
macgorspiehserhalp
authored
feat: enable manual caching from edge (#361)
Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com> Co-authored-by: Philippe Serhal <philippe.serhal@netlify.com>
1 parent ea9d8ef commit efee061

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,17 @@ export async function netlifyCommonEngineHandler(request: Request, context: any)
162162
}
163163
```
164164

165+
### Caching responses from SSR
166+
167+
The Angular Runtime's edge functions are automatically configured with `cache: "manual"`.
168+
This means Netlify will honor Cache Control headers from your SSR responses.
169+
170+
You can use [Angular's server routes](https://angular.dev/guide/ssr#setting-headers-and-status-codes) to control headers in your responses or [customize request handling manually](#customizing-request-handling).
171+
172+
To learn more read Netlify's docs on:
173+
- [Caching] (https://docs.netlify.com/platform/caching/),
174+
- [When to use caching](https://docs.netlify.com/edge-functions/optional-configuration/#when-to-use-caching).
175+
165176
### Limitations
166177

167178
The [`server.ts` file](https://angular.dev/guide/ssr#configure-server-side-rendering) that's part of the Angular scaffolding is meant for deploying to a VM, and is not compatible with this Netlify build plugin for Angular@17 and Angular@18. If you applied changes to that file, you'll need to replicate them in an Edge Function. See (#135)[https://github.com/netlify/angular-runtime/issues/135] for an example.

src/helpers/setUpEdgeFunction.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ const setUpEdgeFunction = async ({ outputPath, constants, failBuild, usedEngine
246246
excludedPath: ${JSON.stringify(excludedPaths)},
247247
generator: "${packageJson.name}@${packageJson.version}",
248248
name: "Angular SSR",
249+
cache: "manual",
249250
};
250251
`
251252

0 commit comments

Comments
 (0)