DioxusLabs/dioxus · error

https is enabled but cert or key path is missing

Error message

https is enabled but cert or key path is missing

What it means

Configuration guard in get_rustls (called from devserver_mainloop): HTTPS is enabled and mkcert is not in use, but the web config did not supply both a certificate path and a key path, so rustls cannot be constructed. The inputs at fault are the missing cert/key fields of the [web.https] configuration.

Solutions

  1. HTTPS is enabled but certificate paths are missing. Provide both the cert and key paths in the config.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/cli/src/serve/server.rs:662 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of DioxusLabs/dioxus@fda3dc9c2b (2026-08-23). Data as JSON: /api/errors/574064f92183fa7d. Report an issue: GitHub.

Appendix: source

Thrown at packages/cli/src/serve/server.rs:687

    insert_no_cache_headers(response.headers_mut());

    response
}

pub(crate) fn insert_no_cache_headers(headers: &mut HeaderMap) {
    headers.insert(CACHE_CONTROL, HeaderValue::from_static("no-cache"));
    headers.insert(PRAGMA, HeaderValue::from_static("no-cache"));
    headers.insert(EXPIRES, HeaderValue::from_static("0"));
}

async fn get_rustls(web_config: &WebHttpsConfig) -> Result<(String, String)> {
    // If we're not using mkcert, just use the cert/key paths given to use in the config
    if !web_config.mkcert.unwrap_or(false) {
        if let (Some(key), Some(cert)) = (web_config.key_path.clone(), web_config.cert_path.clone())
        {
            return Ok((cert, key));
        } else {
            bail!("https is enabled but cert or key path is missing");
        }
    }

    const DEFAULT_KEY_PATH: &str = "ssl/key.pem";
    const DEFAULT_CERT_PATH: &str = "ssl/cert.pem";

    // Get paths to store certs, otherwise use ssl/item.pem
    let key_path = web_config
        .key_path
        .clone()
        .unwrap_or(DEFAULT_KEY_PATH.to_string());

    let cert_path = web_config
        .cert_path
        .clone()
        .unwrap_or(DEFAULT_CERT_PATH.to_string());

    // Create ssl directory if using defaults

View on GitHub (pinned to fda3dc9c2b)