createWebRequestFromNodeRequest
Converts a Node.js IncomingMessage or Http2ServerRequest into a Web Standard Request object.
API
function createWebRequestFromNodeRequest( nodeRequest: IncomingMessage | Http2ServerRequest, trustProxyHeaders?: boolean | readonly string[] | undefined, ): Request;
@paramnodeRequest
IncomingMessage | Http2ServerRequest- The Node.js request object (
IncomingMessageorHttp2ServerRequest) to convert.
@paramtrustProxyHeaders
boolean | readonly string[] | undefined- A boolean or an array of proxy headers to trust when constructing the request URL.
@returns
RequestA Web Standard Request object.
Description
Converts a Node.js IncomingMessage or Http2ServerRequest into a Web Standard Request object.
This function adapts the Node.js request objects to a format that can be used by web platform APIs.
Usage Notes
When trustProxyHeaders is enabled, headers such as X-Forwarded-Host and X-Forwarded-Prefix should ideally be strictly validated at a higher infrastructure level (e.g., at the reverse proxy or API gateway) before reaching the application.
Super-powered by Google ©2010–2025.
Code licensed under an MIT-style License. Documentation licensed under CC BY 4.0.
https://angular.dev/api/ssr/node/createWebRequestFromNodeRequest