pub struct SiteConfig {Show 16 fields
pub name: String,
pub hostname: String,
pub hostnames: Vec<String>,
pub port: u16,
pub static_dir: String,
pub default: bool,
pub api_only: bool,
pub headers: HashMap<String, String>,
pub redirect_to_https: bool,
pub index_files: Vec<String>,
pub error_pages: HashMap<u16, String>,
pub compression: CompressionConfig,
pub cache: CacheConfig,
pub access_control: AccessControlConfig,
pub ssl: SiteSslConfig,
pub proxy: ProxyConfig,
}Expand description
Configuration for a single site (virtual host)
Fields§
§name: StringSite name (for identification)
hostname: StringPrimary hostname for the site
hostnames: Vec<String>Additional hostnames that share the same port and config
port: u16Port to listen on
static_dir: StringDirectory for static files
default: boolWhether this site is the default for its port
api_only: boolIf true, only API endpoints are served (no static files)
headers: HashMap<String, String>Custom headers to add to responses
redirect_to_https: boolWhether to redirect HTTP to HTTPS
index_files: Vec<String>List of index files to try for directories
error_pages: HashMap<u16, String>Custom error pages by status code
compression: CompressionConfigCompression configuration
cache: CacheConfigCaching configuration
access_control: AccessControlConfigCORS and access control configuration
ssl: SiteSslConfigSSL configuration for the site
proxy: ProxyConfigProxy configuration for the site
Implementations§
Source§impl SiteConfig
impl SiteConfig
pub fn validate(&self) -> Result<(), Box<dyn Error>>
pub fn get_ssl_domain(&self) -> Option<&str>
pub fn get_all_ssl_domains(&self) -> Vec<&str>
pub fn is_ssl_enabled(&self) -> bool
pub fn get_index_files(&self) -> Vec<&str>
pub fn get_error_page(&self, status_code: u16) -> Option<&str>
pub fn should_compress(&self, content_type: &str, content_length: usize) -> bool
pub fn get_cache_headers(&self, is_static: bool) -> Vec<(String, String)>
pub fn get_cors_headers(&self) -> Vec<(String, String)>
pub fn url(&self) -> String
Sourcepub fn handles_hostname(&self, hostname: &str) -> bool
pub fn handles_hostname(&self, hostname: &str) -> bool
Check if this site handles the given hostname
Sourcepub fn get_all_hostnames(&self) -> Vec<&str>
pub fn get_all_hostnames(&self) -> Vec<&str>
Get all hostnames handled by this site (primary + additional)
Sourcepub fn handles_hostname_port(&self, hostname: &str, port: u16) -> bool
pub fn handles_hostname_port(&self, hostname: &str, port: u16) -> bool
Check if this site handles the given hostname and port combination
Trait Implementations§
Source§impl Clone for SiteConfig
impl Clone for SiteConfig
Source§fn clone(&self) -> SiteConfig
fn clone(&self) -> SiteConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more