Skip to content

feat: enable manual caching from edge #361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,17 @@ export async function netlifyCommonEngineHandler(request: Request, context: any)
}
```

### Caching responses from SSR

The Angular Runtime's edge functions are automatically configured with `cache: "manual"`.
This means Netlify will honor Cache Control headers from your SSR responses.

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).

To learn more read Netlify's docs on:
- [Caching] (https://docs.netlify.com/platform/caching/),
- [When to use caching](https://docs.netlify.com/edge-functions/optional-configuration/#when-to-use-caching).

### Limitations

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.
Expand Down
1 change: 1 addition & 0 deletions src/helpers/setUpEdgeFunction.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ const setUpEdgeFunction = async ({ outputPath, constants, failBuild, usedEngine
excludedPath: ${JSON.stringify(excludedPaths)},
generator: "${packageJson.name}@${packageJson.version}",
name: "Angular SSR",
cache: "manual",
};
`

Expand Down