Sometimes we want to send HTTP requests to servers that use HTTPS with self-signed certificates. We then need to tell HTTP Client to not check the certificate of the server. This is like running the curl command with the --insecure or '-k' flag. To disable the certificate verification for HTTP Client we need to adjust the http-client.private.env.json file. For the environment we want to disable the certificate verification we must add a SSLConfiguration section. In the SSLConfiguration section we add the verifyHostCertificate property with value 'true'.

In the following example http-client.private.env.json file we have the environments development and production with different passwords. For the development environment we disable the certificate verification and we keep the certificate verification for the production environment.

{
  "development": {
    "password": "mrhaki",
    "SSLConfiguration": {
      "verifyHostCertificate": false
    }
  },
  "production": {
    "password": "mrhaki42"
  }
}

Written with IntelliJ 2023.3.2.

shadow-left