Skip to main content

build_cors_layer

Function build_cors_layer 

Source
pub fn build_cors_layer(origins: &Option<Vec<String>>) -> CorsLayer
Expand description

Constructs a CorsLayer from the node’s CORS configuration.

  • None origins: permissive (Access-Control-Allow-Origin: *).
  • Some(list): restricts to exactly the listed origins.

Applied to public endpoints (.well-known/scp, broadcast projection) so browser-based JavaScript / WASM clients can read responses cross-origin (issue #231). Not applied to the WebSocket relay endpoint (WebSocket upgrades have their own origin mechanism) or the dev API (localhost-only).