Search code examples
angularhttpswebpack-dev-serverclient-certificates

Local backend says cert DN is null when using Angular webpack dev server proxy to local https


I have a local backend (spring) service running on tomcat. I'm able to programmatically make an https request to the server and it responds as expected (same is true when I use the browser for GETs).

When I try to make the request via angular, my backend server says that the DN is null. What would cause my user certs to not be sent to the backened?

This is part of my proxy.conf.js.

'/api': {
    target: `https://localhost:${port}`,
    changeOrigin: true,
    rejectUnatuorized: false,
    secure: false,
    // ssl: {key, cert, ca}, //I've trie it w/ & w/o this
    onProxyReq: (pr, req, res, options) => {/*bunch of logs*/}
  },

 

More info that may or may not be useful:


Solution

  • This solved my problem. Without it, I was seeing an issue related to the fact that I'm using self signed certs.

    '/api': {
        target: `https://localhost:${port}`,
        changeOrigin: true,
        rejectUnatuorized: false,
        secure: false,
        agent: new https.Agent({
            key,
            cert,
            ca,
            rejectUnauthorized: false
        }),    
        onProxyReq: (pr, req, res, options) => {/*bunch of logs*/}
    },