{"record":{"id":"4668d9a75b1b438f","repo":"nautechsystems/nautilus_trader","slug":"description-endpoint-must-use-https-or-canonical","errorCode":null,"errorMessage":"{description} endpoint must use HTTPS or canonical loopback HTTP","messagePattern":"(.+?) endpoint must use HTTPS or canonical loopback HTTP","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/rpc/http.rs","lineNumber":918,"sourceCode":"        }\n\n        let hex_string = parsed\n            .result\n            .ok_or_else(|| BroadcastError::Failed(\"Broadcast returned no result\".to_string()))?;\n\n        B256::from_str(&hex_string)\n            .map_err(|e| BroadcastError::Failed(format!(\"Failed to parse broadcast result: {e}\")))\n    }\n}\n\n#[cfg(feature = \"hypersync\")]\npub(crate) fn validate_execution_endpoint(\n    endpoint: &str,\n    description: &str,\n) -> anyhow::Result<Url> {\n    let url =\n        Url::parse(endpoint).map_err(|_| anyhow::anyhow!(\"Invalid {description} endpoint\"))?;\n    anyhow::ensure!(\n        matches!(url.scheme(), \"http\" | \"https\"),\n        \"{description} endpoint must use HTTPS or canonical loopback HTTP\"\n    );\n    anyhow::ensure!(\n        url.host().is_some(),\n        \"{description} endpoint host is required\"\n    );\n    anyhow::ensure!(\n        url.fragment().is_none(),\n        \"{description} endpoint fragments are unsupported\"\n    );\n    anyhow::ensure!(\n        url.scheme() == \"https\" || is_canonical_loopback_endpoint(endpoint),\n        \"{description} endpoint must use HTTPS unless its host is a canonical loopback IP literal\"\n    );\n    Ok(url)\n}\n","sourceCodeStart":900,"sourceCodeEnd":936,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/rpc/http.rs#L900-L936","documentation":"Thrown by `validate_execution_endpoint` when the URL parses but its scheme is neither `http` nor `https`. The adapter only speaks HTTP(S) JSON-RPC, so schemes like `ws`, `ftp`, or `file` are rejected outright.","triggerScenarios":"Supplying an endpoint with a non-HTTP scheme to `new`, `normalize_endpoint`, or the validation helpers — commonly a WebSocket endpoint (`ws://`/`wss://`) pasted into an HTTP execution-endpoint config field.","commonSituations":"Reusing a websocket RPC URL from another client/library in an HTTP-only config; typo'd scheme (`htps://` fails earlier, but `ws://` reaches this check); internal conventions like `unix://` sockets.","solutions":["Convert the endpoint to HTTPS: replace `wss://` with `https://` if the server also serves HTTP JSON-RPC.","Use `http://` only for canonical loopback addresses (127.0.0.1, [::1]) in local development.","Check that the config field expects an execution (HTTP) endpoint and not a separate websocket field."],"exampleFix":"// before\nlet endpoint = \"wss://mainnet.infura.io/ws/v3/KEY\"; // websocket scheme rejected\n// after\nlet endpoint = \"https://mainnet.infura.io/v3/KEY\";","handlingStrategy":"validation","validationCode":"let url = url::Url::parse(endpoint).map_err(|e| anyhow::anyhow!(\"invalid endpoint: {e}\"))?;\nanyhow::ensure!(matches!(url.scheme(), \"http\" | \"https\"),\n    \"endpoint must be http(s), got '{}'\", url.scheme());","typeGuard":"fn is_http_scheme(s: &str) -> bool {\n    url::Url::parse(s).map(|u| matches!(u.scheme(), \"http\" | \"https\")).unwrap_or(false)\n}","tryCatchPattern":"match HttpRpcClient::new(ws_endpoint) {\n    Err(e) if e.to_string().contains(\"must use HTTPS or canonical loopback HTTP\") => {\n        // config field got a ws:// URL; surface a targeted config error\n        return Err(anyhow::anyhow!(\"HTTP client requires an http(s) endpoint, not a websocket URL\"));\n    }\n    other => other,\n}","preventionTips":["Keep websocket and HTTP endpoint config fields separate; never reuse a wss:// URL in an HTTP field.","Convert wss:// provider URLs to their https:// JSON-RPC equivalent when switching clients.","Validate scheme at config-load time."],"tags":["url","scheme","config","validation"],"backgroundTag":"invalid-url","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}