Which @angular/* package(s) are relevant/related to the feature request?
platform-server
Description
Angular SSR currently enforces maxResponseBodySize (default: 1 MB) for HTTP responses fetched during server-side rendering.
When the limit is exceeded, rendering fails with an error. However, there is currently no built-in mechanism to detect that an application is gradually approaching the limit.
As a result, developers often discover the issue only after a deployment, when an API response grows enough to trigger failures in production (sample).
The current behaviour is effectively a hard failure at 100% utilization with no early feedback. Providing warnings at configurable thresholds would turn an abrupt runtime error into an actionable signal during development and testing.
Proposed solution
Expose diagnostics when the accumulated response size approaches the configured limit.
Possible API:
provideServerRendering(
withHttpTransferCache({
maxResponseBodySize: 1_000_000,
warningThreshold: 0.8,
onResponseBodySizeWarning: (event) => {
console.warn(event);
},
}),
);
where:
interface ResponseBodySizeWarning {
url: string;
receivedBytes: number;
maxResponseBodySize: number;
percentage: number;
}
Alternatives considered
If a public API is considered too large, Angular could emit development-mode warnings by default, for example once the response size exceeds 80% of the configured limit:
SSR HTTP response body size approaching configured limit:
URL: /api/products
Size: 842 kB / 1000 kB (84%)
Production builds could remain silent unless explicitly configured.
Which @angular/* package(s) are relevant/related to the feature request?
platform-server
Description
Angular SSR currently enforces
maxResponseBodySize(default: 1 MB) for HTTP responses fetched during server-side rendering.When the limit is exceeded, rendering fails with an error. However, there is currently no built-in mechanism to detect that an application is gradually approaching the limit.
As a result, developers often discover the issue only after a deployment, when an API response grows enough to trigger failures in production (sample).
The current behaviour is effectively a hard failure at 100% utilization with no early feedback. Providing warnings at configurable thresholds would turn an abrupt runtime error into an actionable signal during development and testing.
Proposed solution
Expose diagnostics when the accumulated response size approaches the configured limit.
Possible API:
where:
Alternatives considered
If a public API is considered too large, Angular could emit development-mode warnings by default, for example once the response size exceeds 80% of the configured limit:
Production builds could remain silent unless explicitly configured.