fix: add Connection: close to prevent keep-alive socket reuse after abort

When AbortController.abort() resets a TCP connection mid-request,
Chromium may reuse the same keep-alive socket for the next request.
Valhalla's HTTP server then returns ERR_EMPTY_RESPONSE. Forcing
Connection: close ensures each request uses a fresh TCP connection.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-31 15:55:15 +02:00
parent 63eb6b921d
commit 7319184f74

View File

@@ -104,7 +104,7 @@ export async function fetchIsochrones(
try {
response = await fetch(`${VALHALLA_BASE}/isochrone`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
headers: { 'Content-Type': 'application/json', 'Connection': 'close' },
body,
signal: abortController.signal
})