• Overview
@angular/ssr/node

createWebRequestFromNodeRequest

function

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;

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.

Jump to details