Today I Learned

How to setup HTTPS on CRA with Craco

There are tutorials for setting up HTTPS for CRA like this one but if you are using craco to override webpack config, then setting SSL_CRT_FILE=./.cert/cert.pem SSL_KEY_FILE=./.cert/key.pem env variables does not properly link the cert and key files. In order to do so you need to add below config to craco.config.js

module.exports = {
  devServer: {
    https: {
      key: fs.readFileSync('./.cert/key.pem'),
      cert: fs.readFileSync('./.cert/cert.pem'),
    },
  },
}

craco docs

webpack docs

Kudos to TRomik who helped me with that.