Angular SSR redirects can take healthy proxies upstreams out of rotation through an unbounded Location header
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
- #34366 de @SkyZeroZx — cerrado sin fusionar
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- Medio día
- Aptitud para principiantes
- 30/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- angular, nginx, nodejs, typescript
- Área
- backend
Línea de trabajo
Start with createRedirectResponse() in the Angular SSR package, where resHeaders.set("Location", location) sets the header without a length check, and with the render-redirect path from #31497 that sends the Router's final URL. Linked PR #34366 is already open against this issue, so read it first. Reproduce with the lab repo linked in the issue, using a long query string. Done means the response no longer produces an oversized Location for such requests, with a test covering it.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
createRedirectResponse() sets Location from request data without any length limit:
resHeaders.set("Location", location);
Route redirects copy request path segments into a relative redirectTo, and render redirects send the Router's final URL, query included, when it differs from the request (#31497). Both are intended, but nothing bounds the size. The header is at least as large as the request, and percent-encoding on the way makes it bigger: new URL() encodes " ' < > and the Router's query serializer encodes characters like / = ? |, so it is about 3x a raw request, and about 5x when a guard puts state.url in returnUrl and the % is encoded again. Both encodings are correct.
Behind nginx this affects other users. The response doesn't fit in nginx's default 4k proxy_buffer_size, so nginx answers 502 and counts it as a failed attempt for that backend (max_fails=1, fail_timeout=10s). With two backends and one worker, two unauthenticated GETs leave the upstream empty and every request gets 502 for about ten seconds, while both Node processes are fine.
I think this is bit similar as unpoly-rails GHSA-m875-3xf6-mf78.
A buffer sized for the app's largest redirect avoids it, but nothing tells the operator that size and it changes when someone adds a guard: for the plain returnUrl guard at nginx's 8 KB request line it is about 40 KB. max_fails=0 also avoids it, by turning passive health checks off.
The app doesn't need any redirect. With the server routes on RenderMode.Server, as in the SSR guide, this request gets a 302 with a 4,208 B Location:
GET /home/(x)?q=<1,400 raw "> 1,412 B
The ** route drops the unmatched (x) group, so the Router ends on /home?q=.... In the browser that is a replaceState; on the server #31497 turns it into a 302. Nothing in the Router needs to change.
Minimal Reproduction
// app.routes.ts
export const routes: Routes = [
{ path: "", component: Home },
{ path: "home", component: Home },
{ path: "**", component: NotFound },
];
// app.routes.server.ts
export const serverRoutes: ServerRoute[] = [
{ path: "**", renderMode: RenderMode.Server },
];
ng build
NG_ALLOWED_HOSTS=localhost PORT=4000 node dist/app/server/server.mjs &
NG_ALLOWED_HOSTS=localhost PORT=4001 node dist/app/server/server.mjs &
nginx with one worker and nothing else tuned:
worker_processes 1;
events {}
http {
upstream ssr {
server 127.0.0.1:4000;
server 127.0.0.1:4001;
}
server {
listen 8080;
location / {
proxy_pass http://ssr;
proxy_set_header Host localhost;
}
}
}
The request has to go out raw, fetch and node:http percent-encode the quotes first. I sent one per second for 25 s while normal traffic hit /home, and counted until /home answered 200 again:
| Setup | /home OK |
|---|---|
| nginx, the config above | 15.2% |
| nginx, Compose service with two replicas | 9.5% |
| nginx image as shipped on 2 vCPUs (two workers) | 25.2% |
nginx, worker_processes auto with a shared zone |
9.3% |
OpenResty, plain upstream |
4.8% |
Kong 3.7, passive checks with 502 in unhealthy.http_statuses |
1.3% |
| nginx, one backend | 100% |
| Same setups without those requests | 100% |
I also reproduced it on a VPS with nginx behind Cloudflare.
See https://github.com/SkyZeroZx/angular-ssr-location-lab
Exception or Error
[error] upstream sent too big header while reading response header from upstream, request: "GET /home/(x)?q=..."
[warn] upstream server temporarily disabled while reading response header from upstream
[error] no live upstreams while connecting to upstream, request: "GET /home HTTP/1.1"
Your Environment
Angular CLI 22.2.2
@angular/ssr 22.2.2
@angular/core 22.2.2
@angular/router 22.2.2
Node.js 22.23.3
Build production
Engine AngularNodeAppEngine
Render mode RenderMode.Server
nginx 1.27.5, 1.29.3, 1.30.4 and 1.31.2
- Lenguaje dominante
- TypeScript
- Estrellas
- 27k
- Forks
- 11.8k
- Merge medio
- 1 d 6 h
- PR fusionados (30 d)
- 216
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de angular/angular-cli
-
Can't use an array of hostnames in --allowedHosts cli parameter in @angular/build:dev-serverAbiertoarea: @angular/build gemini-triaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
angular/angular-cli#33955 ·
Los mantenedores suelen responder en 1 día
-
area: @angular/cli gemini-triaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
angular/angular-cli#33055 · 1 comentario · 3 reacciones ·
Los mantenedores suelen responder en 1 día
-
@angular/cli 21.2.x and 20.3.x depend on @modelcontextprotocol/[email protected] which is vulnerable to CVE-2026-111767, CVE-2026-111768, CVE-2026-111769 and CVE-2026-111771Posiblemente ocupada @florimond-collette la tomó hoy. Abiertoarea: @angular/cli
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
angular/angular-cli#34455 ·
Los mantenedores suelen responder en 1 día
-
@angular/build 22.2.x, 21.2.x and 20.3.x depend on [email protected] / [email protected] which are vulnerable to CVE-2026-112943Posiblemente ocupada @florimond-collette la tomó hoy. Abiertoarea: @angular/build
Dificultad 3/5 1-2 días Aptitud para principiantes 25/100
angular/angular-cli#34452 ·
Los mantenedores suelen responder en 1 día
-
`ng generate app-shell` and `ng generate module --route` produce broken imports when a component `type` is configuredPosiblemente ocupada @MeAkib la tomó hace 1 día. Abiertoarea: @schematics/angular
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
angular/angular-cli#34449 ·
Los mantenedores suelen responder en 1 día
Todos los issues de angular/angular-cli
Issues similares
-
[BUG] rag: sentence content can cross the reported sentence boundariesPosiblemente ocupada @LJK-ikun la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
bug needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
README: the Resource URI Schemas example's file://documents/* pattern only matches that literal URIAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
platformatic/mcp#361 ·
Los mantenedores suelen responder en 1 día
-
frontend
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Push: sem service worker ou sem VAPID, o interruptor de Notificações fica ligado sem avisar nadaAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
melgarafael/DeskcommCRM#3164 ·
Los mantenedores suelen responder en 1 día