diff --git a/packages/angular_devkit/build_angular/src/builders/dev-server/vite-server.ts b/packages/angular_devkit/build_angular/src/builders/dev-server/vite-server.ts index efc409b76a04..c7048a8b99c6 100644 --- a/packages/angular_devkit/build_angular/src/builders/dev-server/vite-server.ts +++ b/packages/angular_devkit/build_angular/src/builders/dev-server/vite-server.ts @@ -33,7 +33,6 @@ import { Schema as BrowserBuilderOptions } from '../browser-esbuild/schema'; import { loadProxyConfiguration } from './load-proxy-config'; import type { NormalizedDevServerOptions } from './options'; import type { DevServerBuilderOutput } from './webpack-server'; -import { ConnectionOptions } from 'node:tls'; interface OutputFileRecord { contents: Uint8Array; @@ -681,11 +680,9 @@ export async function setupServer( } transformIndexHtmlAndAddHeaders(url, rawHtml, res, next, async (html) => { - const url = new URL(req.originalUrl ?? '/', server.resolvedUrls?.local[0]); - const { content } = await renderPage({ document: html, - route: url.toString(), + route: new URL(req.originalUrl ?? '/', server.resolvedUrls?.local[0]).toString(), serverContext: 'ssr', loadBundle: (uri: string) => // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -800,25 +797,6 @@ export async function setupServer( configuration.plugins ??= []; configuration.plugins.push(basicSslPlugin()); } - - if (ssr) { - // Patch the TLS module to allow self signed certificate requests when running SSR. - // We cannot use `NODE_EXTRA_CA_CERTS` as this is only read once when launching Node.js - // and using `NODE_TLS_REJECT_UNAUTHORIZED` would apply globally and a warning is shown. - const tls = await import('node:tls'); - const originalConnect = tls.connect; - tls.connect = function (...args) { - if (args && typeof args === 'object') { - const options = args[0] as ConnectionOptions; - if (options.host === serverOptions.host && options.port == serverOptions.port) { - options.rejectUnauthorized = false; - } - } - - // eslint-disable-next-line @typescript-eslint/no-explicit-any - return originalConnect.apply(this, args as any); - }; - } } return configuration;