pub struct ServeOptions {
pub bind: SocketAddr,
pub forward: ForwardConfig,
pub allowed_hosts: Vec<String>,
pub allowed_origins: Vec<String>,
}Expand description
Options for serve.
Fields§
§bind: SocketAddrAddress to bind, e.g. 0.0.0.0:8000.
forward: ForwardConfigWhich inbound headers to forward to the upstream service per request.
allowed_hosts: Vec<String>In-process Host validation (DNS-rebinding protection). Empty = off, for deployments
behind a validating ingress (Emperor Profile E5).
allowed_origins: Vec<String>In-process Origin validation, entries with a scheme (https://app.example). Empty = off.
Implementations§
Source§impl ServeOptions
impl ServeOptions
Sourcepub fn new(bind: SocketAddr) -> ServeOptions
pub fn new(bind: SocketAddr) -> ServeOptions
Build options from a bind address and the common “forward only Authorization” header policy.
Sourcepub fn with_forward(self, forward: ForwardConfig) -> ServeOptions
pub fn with_forward(self, forward: ForwardConfig) -> ServeOptions
Override the forwarded-header allow-list (e.g. for MCPs that use
X-* credential headers instead of / in addition to Authorization).
Sourcepub fn with_allowed_hosts<I, S>(self, hosts: I) -> ServeOptions
pub fn with_allowed_hosts<I, S>(self, hosts: I) -> ServeOptions
Validate the Host header in-process (e.g. ["localhost", "mcp.example.com"]), for
deployments without a validating ingress in front.
Sourcepub fn with_allowed_origins<I, S>(self, origins: I) -> ServeOptions
pub fn with_allowed_origins<I, S>(self, origins: I) -> ServeOptions
Validate the Origin header in-process (entries include the scheme). Requests without
an Origin header (non-browser clients) still pass.