Skip to content

Commit d095e54

Browse files
committed
fix(@angular/ssr): add Cache-Control and Vary headers to redirects
Always include Cache-Control: no-store and Vary: X-Forwarded-Prefix headers in redirect responses. This prevents improper caching of redirects and ensures that down-stream caches or proxies correctly handle the X-Forwarded-Prefix header.
1 parent 81856fd commit d095e54

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

packages/angular/ssr/src/utils/redirect.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ export function createRedirectResponse(location: string, status = 302): Response
4141
status,
4242
headers: {
4343
'Location': location,
44+
'Cache-Control': 'no-store',
45+
'Vary': 'X-Forwarded-Prefix',
4446
},
4547
});
4648
}

0 commit comments

Comments
 (0)