Skip to content

Commit

Permalink
fix(ssr): Prevent overwriting Link response header if already set on …
Browse files Browse the repository at this point in the history
…storefront render output
  • Loading branch information
leomp12 committed Oct 13, 2023
1 parent fd87e5a commit 3e30407
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/ssr/src/firebase/serve-storefront.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export default async (req: Request, res: Response) => {
/* eslint-disable prefer-rest-params */
// @ts-ignore
res.writeHead = function writeHead(status: number, headers: OutgoingHttpHeaders) {
if (status === 200 && headers && cssFilepath) {
if (status === 200 && headers && cssFilepath && !headers.link) {
// https://community.cloudflare.com/t/early-hints-need-more-data-before-switching-over/342888/21
headers.Link = `<${cssFilepath}>; rel=preload; as=style`;
}
Expand Down

0 comments on commit 3e30407

Please sign in to comment.