SSL

Garvan supports HTTPS through OpenSSL. You can run the server directly on TLS, or terminate it at a reverse proxy — see the proxies guide for the latter.

Enabling SSL

SSL must be enabled at build time. Add -DCROW_ENABLE_SSL to your compiler flags and link against OpenSSL:

find_package(OpenSSL REQUIRED)
target_compile_definitions(app_bin PRIVATE CROW_ENABLE_SSL)
target_link_libraries(app_bin PRIVATE OpenSSL::SSL OpenSSL::Crypto)

Certificates

Point the app at a certificate and private key:

app.bindaddr("0.0.0.0")
   .port(443)
   .ssl_file("certs/fullchain.pem", "certs/privkey.pem")
   .multithreaded()
   .run();
Tip

If you only need development certificates, openssl req -x509 -newkey rsa:2048 -nodes -keyout privkey.pem -out fullchain.pem -days 30 -subj /CN=localhost produces a self-signed pair in seconds.