Skip to main content

is_local_origin

Function is_local_origin 

Source
pub fn is_local_origin(origin: &str) -> bool
Expand description

Returns true if the origin string resolves to a local host.

Accepted hosts: localhost, 127.0.0.1, ::1, tauri.localhost.

Schemes http and https are accepted; ports are ignored. Tauri custom schemes (tauri://localhost, asset://localhost) are also accepted. URLs with userinfo (e.g. http://user@localhost) are rejected to prevent credential-injection bypasses. Malformed URLs, missing hosts, and non-local hosts return false.