Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): construct SSR request URL using s…
Browse files Browse the repository at this point in the history
…erver resolvedUrls

With vite `header.host` is undefined when SSL is enabled. This resulted in an invalid URL to be constructed.

Closes angular#26652
  • Loading branch information
alan-agius4 committed Dec 13, 2023
1 parent 5370b03 commit c833bf9
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -680,11 +680,9 @@ export async function setupServer(
}

transformIndexHtmlAndAddHeaders(url, rawHtml, res, next, async (html) => {
const protocol = serverOptions.ssl ? 'https' : 'http';
const route = `${protocol}://${req.headers.host}${req.originalUrl}`;
const { content } = await renderPage({
document: html,
route,
route: new URL(req.originalUrl ?? '/', server.resolvedUrls?.local[0]).toString(),
serverContext: 'ssr',
loadBundle: (uri: string) =>
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down

0 comments on commit c833bf9

Please sign in to comment.