AngularAppEngine
Angular server application engine. Manages Angular server applications (including localized ones), handles rendering requests, and optionally transforms index HTML before rendering.
API
class AngularAppEngine { constructor(options?: AngularAppEngineOptions | undefined): AngularAppEngine; handle(request: Request, requestContext?: unknown): Promise<Response | null>;}
constructor
AngularAppEngineCreates a new instance of the Angular server application engine.
AngularAppEnginehandle
Promise<Response | null>Handles an incoming HTTP request by serving prerendered content, performing server-side rendering,
or delivering a static file for client-side rendered routes based on the RenderMode setting.
Request- The HTTP request to handle.
unknown- Optional context for rendering, such as metadata associated with the request.
Promise<Response | null>A request to https://www.example.com/page/index.html will serve or render the Angular route
corresponding to https://www.example.com/page.
To prevent potential Server-Side Request Forgery (SSRF), this function verifies the hostname
of the request.url against a list of authorized hosts.
If the hostname is not recognized and allowedHosts is not empty, a Client-Side Rendered (CSR) version of the
page is returned otherwise a 400 Bad Request is returned.
Resolution:
Authorize your hostname by configuring allowedHosts in angular.json in:
projects.[project-name].architect.build.options.security.allowedHosts.
Alternatively, you pass it directly through the configuration options of AngularAppEngine.
For more information see: https://angular.dev/best-practices/security#preventing-server-side-request-forgery-ssrf
Usage Notes
This class should be instantiated once and used as a singleton across the server-side application to ensure consistent handling of rendering requests and resource management.