Skip to content

fix(@angular/build): force HTTP/1.1 in dev-server SSR with SSL #29147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion packages/angular/build/src/builders/dev-server/vite-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,15 @@ export async function setupServer(
headers: serverOptions.headers,
// Disable the websocket if live reload is disabled (false/undefined are the only valid values)
ws: serverOptions.liveReload === false && serverOptions.hmr === false ? false : undefined,
proxy,
// When server-side rendering (SSR) is enabled togather with SSL and Express is being used,
// we must configure Vite to use HTTP/1.1.
// This is necessary because Express does not support HTTP/2.
// We achieve this by defining an empty proxy.
// See: https://github.com/vitejs/vite/blob/c4b532cc900bf988073583511f57bd581755d5e3/packages/vite/src/node/http.ts#L106
proxy:
serverOptions.ssl && ssrMode === ServerSsrMode.ExternalSsrMiddleware
? (proxy ?? {})
: proxy,
cors: {
// Allow preflight requests to be proxied.
preflightContinue: true,
Expand Down
Loading