Search code examples
securitywebpackproxydevserver

What does "secure" mean from Webpack, devServer proxy?


From the official page from webpack(DevServer),
secure property is written like 'false' with explanation like below:

module.exports = {
  //...
  devServer: {
    proxy: {
      '/api': {
        target: 'https://other-server.example.com',
        secure: false,
      },
    },
  },
};

In the function, you get access to the request, response, and proxy options.

Return null or undefined to continue processing the request with proxy.
Return false to produce a 404 error for the request.
Return a path to serve from, instead of continuing to proxy the request.

my question could be a bit silly,
but does the "secure" property mean that
Return false to produce a 404 error for the request ?

I'm just setting those props for the first time,
so it would be better if understood more clearly.

Thanks!


Solution

  • secure: true means:

    A backend server running on HTTPS with an invalid certificate will not be accepted by default.

    So if you want to accept invalid (missconfigured, broken cert chain, revoked, etc. ) cert than use secure: false