This commit is contained in:
Mateusz Gruszczyński committed 2026-10-04 22:53:33 +02:00
1 parent 174389e5b1
commit e6604e41fc
73 files changed
+1240 -201

No files matched your search

+6
View File
@@ -191,7 +191,12 @@ pub struct CompiledRoute {
pub response: Option<crate::vhost::LocationResponse>,
pub source: CompiledSource,
pub backend: Option<Arc<CompiledBackend>>,
pub acl_profile_id: Option<String>,
pub profile_acl: Option<CompiledAcl>,
pub profile_country_access: crate::rate_limit::CountryAccess,
pub acl: Option<CompiledAcl>,
pub country_access: crate::rate_limit::CountryAccess,
pub method_policy: crate::vhost::MethodPolicy,
pub headers: CompiledHeaders,
}
#[derive(Debug)]
@@ -214,6 +219,7 @@ pub struct CompiledFrontend {
pub backend_header: bool,
pub backend_timing_header: bool,
pub rate_limit: crate::rate_limit::Settings,
pub method_policy: crate::vhost::MethodPolicy,
pub basic_auth: Option<crate::basic_auth::Compiled>,
pub metrics: Arc<crate::metrics::VhostMetrics>,
pub server_header: crate::settings::ServerHeader,
+22
View File
@@ -171,6 +171,7 @@ for host in &mut config.vhosts {
backend_header: host.backend_header,
backend_timing_header: host.backend_timing_header,
rate_limit: host.rate_limit.clone(),
method_policy: host.method_policy.clone(),
basic_auth: host.basic_auth.compile()?,
server_header: host
.server_header
@@ -226,7 +227,12 @@ for host in &mut config.vhosts {
response: None,
source: fallback_source,
backend: fallback_backend,
acl_profile_id: None,
profile_acl: None,
profile_country_access: crate::rate_limit::CountryAccess::default(),
acl: None,
country_access: crate::rate_limit::CountryAccess::default(),
method_policy: crate::vhost::MethodPolicy::default(),
headers: crate::headers::CompiledHeaders::default(),
};
for name in &host.frontend.hosts {
@@ -282,6 +288,17 @@ for host in &mut config.vhosts {
);
validate_route_rewrite(route, path_regex.as_ref())?;
validate_location_response(route.response.as_ref())?;
let (route_profile_acl, route_profile_country_access) = match route.acl_profile_id.as_deref() {
Some(id) => acl_profiles.get(id).cloned().ok_or_else(|| {
anyhow::anyhow!(
"vhost {} location {} references unknown ACL profile {}",
host.id,
route.id,
id
)
})?,
None => (None, crate::rate_limit::CountryAccess::default()),
};
let acl = route.acl.as_ref().map(Acl::compile).transpose()?;
let headers = route.headers.compile()?;
if route.source.is_reverse_proxy() {
@@ -339,7 +356,12 @@ for host in &mut config.vhosts {
response: route.response.clone(),
source,
backend,
acl_profile_id: route.acl_profile_id.clone(),
profile_acl: route_profile_acl,
profile_country_access: route_profile_country_access,
acl,
country_access: route.country_access.clone(),
method_policy: route.method_policy.clone(),
headers,
};
for name in &host.frontend.hosts {