From f76432368055264a459f57619b7aa73808929439 Mon Sep 17 00:00:00 2001 From: Chris Park Date: Wed, 1 Nov 2023 11:55:20 +1030 Subject: [PATCH] DO-1563: (Legacy) Log custom header having the Prerender requester's User-Agent information --- packages/prerender-proxy/lib/handlers/prerender-check.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/prerender-proxy/lib/handlers/prerender-check.ts b/packages/prerender-proxy/lib/handlers/prerender-check.ts index 879c1d25..6ab03ad3 100644 --- a/packages/prerender-proxy/lib/handlers/prerender-check.ts +++ b/packages/prerender-proxy/lib/handlers/prerender-check.ts @@ -26,6 +26,14 @@ export const handler = async ( request.headers["x-prerender-host"] = [ { key: "X-Prerender-Host", value: request.headers.host[0].value }, ]; + + // Custom header to be forwarded to Prerender service for better logging + request.headers["x-prerender-user-agent"] = [ + { + key: "x-prerender-user-agent", + value: request.headers["user-agent"][0].value, + }, + ]; } }