-
-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Description
Description
As a corporate developer, I load in multiple certificates when using Vite, and would like automatic URL hostname detection to work the same as it does for a single certificate.
Node explicitly allows multiple certificates and keys to be used, and this seems like an arbitrary, undocumented, Vite limitation.
Suggested solution
The resolveServerUrls function handles a single certificate. The logic could easily be expanded to handle multiple certificates.
httpsOptions?.cert && !Array.isArray(httpsOptions.cert)
Alternative
Support more than one "host" in the server
config section.
Adding custom host URLs involves writing a plugin with the following:
export function MyPlugin(): VitePlugin {
return {
name: "MultipleUrlPlugin",
async configureServer(this: MinimalPluginContextWithoutEnvironment, server: ViteDevServer): Promise<void> {
httpsServer.on('listening', () => {
server.resolvedUrls = customResolveServerUrls(...)
})
}
}
}
Additional context
Node v22 has some problems with multiple certificates, and can use PFX files as well as cert/key pairs. Bugs/Feature requests relating to those are outside the scope of this.
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.