Quasar devServer HTTPS and Vite proxy HTTPS certificate validation
0 reputation · 14 Dec 2023, 22:23 UTC
0 reputation · 14 Dec 2023, 22:23 UTC
Quasar CLI v2+ uses Vite as the dev server. HTTPS is configured via devServer.https in quasar.config.js as a boolean for auto-generated self-signed certs or an object with key/cert/ca paths. devServer.proxy forwards API requests to backend services.
Certificate validation for proxied HTTPS requests is performed by Node.js using its built-in trust store. Quasar does not provide a built-in mechanism to automatically trust project-local CAs for proxied requests. The effective trust model differs across deployment targets: SPA/PWA/SSR run in Node.js during development, while Capacitor/Cordova mobile apps and Electron builds use platform-specific web views with separate certificate trust requirements.
The design uncertainty is how certificate trust should be expressed for both the dev server TLS and the proxy agent, and whether it can be kept consistent across targets without relying on external process configuration.
Does Quasar CLI currently propagate a custom CA from devServer.https.ca to the proxy httpsAgent used by Vite? Is there a plan to expose a first-class devServer.ca option that applies to both dev server TLS and proxy agent across SPA, SSR, Capacitor and Electron targets? What is the intended approach for maintaining consistent certificate validation between the Vite dev server and proxied backends during development?
No. Quasar CLI v2+ does not propagate devServer.https.ca into the Vite proxy httpsAgent. devServer.https configures the development server's own TLS listener. Proxy entries control backend requests independently, and Quasar does not document a shared CA bridge between them. There is no published plan for a first-class devServer.ca option spanning SPA, SSR, Capacitor, and Electron targets.
Confirmed: devServer.https accepts a boolean for auto-generated certificates or an object with key, cert, and ca. In Node/Vite TLS configuration, ca is primarily used to verify client certificates when mutual TLS is enabled; it does not make browsers or web views trust the server certificate.
Confirmed: proxy trust is decided by the Node process running Vite. Each devServer.proxy entry can specify its own agent. Quasar does not expose a global proxy CA option that inherits from devServer.https.ca.
Likely explanation: the two trust decisions are intentionally separate. The dev server certificate must be trusted by each client. The proxy must trust the backend certificate separately within Node. Combining them would conflate client trust with server-side outbound trust.
devServer.proxy or call the backend directly from the client or web view.import fs from 'node:fs';
import path from 'node:path';
import https from 'node:https';
const caPath = path.resolve(__dirname, 'certs', 'local-ca.pem');
export default function (ctx) {
return {
devServer: {
https: {
key: fs.readFileSync(path.resolve(__dirname, 'certs', 'server.key')),
cert: fs.readFileSync(path.resolve(__dirname, 'certs', 'server.crt')),
ca: [fs.readFileSync(caPath)]
},
proxy: {
'/api': {
target: 'https://backend.local:8443',
changeOrigin: true,
agent: new https.Agent({
ca: [fs.readFileSync(caPath)]
})
}
}
}
};
}
Alternatively, run NODE_EXTRA_CA_CERTS=/abs/path/local-ca.pem quasar dev so Node trusts the backend CA for outbound requests from the Vite process.
Confirm whether the failing request originates from the browser or web view through Vite proxy, or directly from the app to the backend. If it bypasses the proxy, NODE_EXTRA_CA_CERTS will not help; trust the backend CA on the client or operating system instead.
devServer.ca is confirmed. Do not design around an undocumented feature.devServer.proxy, capture the exact Node error, then rerun with NODE_EXTRA_CA_CERTS set to that CA PEM and no other change.openssl s_client -connect localhost:PORT -servername localhost and confirm the issuer and chain in the browser or operating-system trust view.quasar info to confirm @quasar/app-vite and Vite versions before applying version-specific configuration.Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.