Only the last Set-Cookie is returned for responses served through a route rewrite to a linked Functions backend
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
Direzione di ricerca
Start with the linked Node.js Functions backend and staticwebapp.config.json, comparing direct /api/login requests with requests rewritten to /api/ssr. Reproduce the deployed behavior against the SWA CLI emulator and trace how rewritten responses parse and forward Set-Cookie headers. Done means both cookies reach the client through the rewrite, matching direct-route behavior.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
A linked Azure Functions backend returns two Set-Cookie headers. Requests to the function route (/api/login) receive both. Requests served through a route rewrite ("route": "/*", "rewrite": "/api/ssr") receive only the last one. Each cookie on its own works, and both use the same domain and attributes. The SWA CLI emulator returns both cookies on every route.
To Reproduce
The function (Node.js, @azure/functions v4 with app.setup({ enableHttpStream: true })) returns these cookies through HttpResponse.cookies:
oauth=…; Domain=<host>; Path=/; HttpOnly; Secure; SameSite=Lax
oct_return_to=%2Fdocs; Max-Age=600; Domain=<host>; Path=/api/login; HttpOnly; Secure; SameSite=Lax
staticwebapp.config.json (relevant part):
{
"routes": [
{ "route": "/api/login", "methods": ["GET", "POST"] },
{ "route": "/*", "rewrite": "/api/ssr" }
]
}
| Request | Deployed SWA | func start + swa start (CLI 2.0.10) |
|---|---|---|
POST /api/login?returnTo=%2Fdocs |
2 Set-Cookie |
2 Set-Cookie |
POST /auth/login?redirectUrl=%2Fdocs (rewritten to /api/ssr) |
1 Set-Cookie (last one only) |
2 Set-Cookie |
POST /auth/login.data?redirectUrl=%2Fdocs (rewritten to /api/ssr) |
1 Set-Cookie (last one only) |
2 Set-Cookie |
The same build artifact was used in both columns. Running the function app on its own (func start, requests sent straight to /api/ssr) also returns both cookies. The behaviour is the same with and without a CDN in front of the static web app.
Expected behavior
All Set-Cookie headers returned by the linked backend are forwarded to the client, regardless of whether the request matched a rewrite rule.
Additional context
- Every
Set-Cookiethat reaches the client has lowercased attributes (max-age=600; domain=…; path=…), so SWA appears to parse and re-serialize cookies; the drop seems to happen in that step. - Related: #278 (same symptom, fixed in 2021 for direct API routes), #760, #1214.
- Lingua principale
- Nessun dato sulla lingua
- Stelle
- 347
- Fork
- 68
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Azure/static-web-apps
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
Azure/static-web-apps#1764 · 2 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
Azure/static-web-apps#1827 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
Azure/static-web-apps#1826 · 5 commenti · 1 reazione ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
Azure/static-web-apps#1825 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 18/100
Azure/static-web-apps#1824 ·
Tutte le issue di Azure/static-web-apps
Issue simili
-
[Bug]: The trt-decoder extra installs TensorRT 11, which the trt_decoder plugin cannot loadForse già presa @fedonman l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
signalwire/freeswitch#3329 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 87/100
kajisho5/ffmpeg-skill#861 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
home-assistant-libs/tuya-device-handlers#848 ·
I maintainer di solito rispondono entro 1 giorno