How to set up HTTPS in OpenBullet 2

If you want to configure HTTPS without setting up a reverse proxy like nginx or using ngrok/Cloudflare tunneling, you can edit the appsettings.json file like this

{
  "ConnectionStrings": {
    "DefaultConnection": "Data Source=UserData/OpenBullet.db;"
  },
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  },
  "Resources": {
    "WorkerThreads": 1000,
    "IOThreads": 1000,
    "ConnectionLimit": 1000
  },
  "Culture": {
    "UseCookie": false
  },
  "Kestrel": {
    "Endpoints": {
      "Http": {
        "Url": "http://localhost:5000"
      },
      "Https": {
        "Url": "https://localhost:5001",
        "Certificate": {
          "Path": "<path to .pfx file>",
          "Password": "<certificate password>"
        }
      }
    }
  }
}

In this case the endpoints were set up to listen from localhost. If you want to listen on all IPs you should replace localhost with 0.0.0.0

You can obtain a certificate from any domain provider (e.g. Cloudflare). When you set up a LetsEncrypt cert, Cloudflare will give you a cert and pem, to obtain a pfx file you will need to follow this guide.

2 Likes