JSS/NextJS: how to disable SSL cert validation via ProxyConfig.proxyOptions.secure setting

I'm running in connected mode on my local and I want to disable SSL cert validation. According to the Sitecore docs, this option is mentioned:

... in the SSR application jss-proxy-ssr, in the config.js file, in the proxyOptions object, you can disable SSL validation entirely by setting the secure to false option. For example:

proxyOptions: {

// Setting this to false will disable SSL certificate validation
// when proxying to a SSL Sitecore instance.
// This is a major security issue, so NEVER EVER set this to false
// outside local development. Use a real CA-issued certificate.
// NEVER EVER do this in production. It will make your SSL completely insecure.

secure: false
}


It's not clear how to actually do this. I started by searching for proxyOptions in the JSS repo. I looked into making the change in bootstrap.ts via the configOverride var, but it's only a simple list of key value pairs which doesn't appear to support tunnelling into ProxyConfig.proxyOptions.secure:

const configOverride: { [key: string]: string } = {};

• What is the use case here? The Next.js/JSS doesn't proxy the CD's like React/Angular/Vue+JSS does. Are you trying use http for the GraphQL service call? Nov 22, 2022 at 17:00
• I'm running this via npm run start:connected which corresponds to script npm-run-all --serial bootstrap --parallel next:dev start:watch-components. The use case is that I want to avoid uploading the certificate in the node store. Experience editor is running on https://sitecore10u2.sc and the front end is running on http://localhost:3000. I have NODE_TLS_REJECT_UNAUTHORIZED=0, as recommended here (getfishtank.ca/blog/next-build-certificate-error-sitecore), but I still experience SSL issues. Nov 22, 2022 at 17:05

The ProxyConfig.proxyOptions.secure setting likely isn't applicable in this case because there is no proxy involved. Also, as the docs state, disabling SSL isn't a great practice.

Instead of trying to disable SSL validation to fix my issues, I opted to make SSL validation work by adding my SIF Trusted Root certificate to Node. In short:

setx NODE_EXTRA_CA_CERTS C:\some\path\to\my-shiny-sif-certificate.cer

Sitecore has a solid guide: