v0.36.5
This commit is contained in:
1 parent
34490fd5fc
commit
6ef01212ec
21 files changed
+204
-77
No files matched your search
+14
-5
@@ -46,7 +46,11 @@ impl PathRoute {
|
||||
}
|
||||
impl Vhost {
|
||||
pub fn validate(&mut self) -> Result<()> {
|
||||
ensure!(crate::config::valid_id(&self.id), "invalid vhost id");
|
||||
ensure!(
|
||||
crate::config::valid_id(&self.id),
|
||||
"invalid vhost id {:?}: use 1-64 letters, digits, '-' or '_'",
|
||||
self.id
|
||||
);
|
||||
ensure!(
|
||||
!self.websocket_legacy_support || self.websockets,
|
||||
"legacy WebSocket compatibility requires WebSocket support to be enabled"
|
||||
@@ -69,12 +73,16 @@ impl Vhost {
|
||||
);
|
||||
ensure!(
|
||||
!self.frontend.hosts.is_empty(),
|
||||
"vhost requires at least one hostname"
|
||||
"vhost requires at least one hostname (for example app.example.com) in the Frontend section"
|
||||
);
|
||||
let mut hosts = std::collections::HashSet::new();
|
||||
for host in &mut self.frontend.hosts {
|
||||
*host = crate::config::normalize_host_pattern(host)?;
|
||||
ensure!(hosts.insert(host.clone()), "duplicate vhost hostname");
|
||||
ensure!(
|
||||
hosts.insert(host.clone()),
|
||||
"hostname {} is listed twice in this vhost",
|
||||
host
|
||||
);
|
||||
}
|
||||
if let Some(target) = &mut self.www_redirect_target {
|
||||
*target = crate::config::normalize_host_pattern(target)?;
|
||||
@@ -101,7 +109,7 @@ impl Vhost {
|
||||
self.content_type_policy.validate()?;
|
||||
ensure!(
|
||||
!self.frontend.listener_ids.is_empty(),
|
||||
"vhost requires at least one named listener"
|
||||
"select at least one listener for this vhost in the Frontend section"
|
||||
);
|
||||
ensure!(
|
||||
self.frontend.listener_ids.len() <= 16,
|
||||
@@ -150,7 +158,8 @@ impl Vhost {
|
||||
for route in &mut self.routes {
|
||||
ensure!(
|
||||
crate::config::valid_id(&route.id) && route_ids.insert(route.id.clone()),
|
||||
"invalid/duplicate vhost path id"
|
||||
"location ID {:?} is invalid or used twice in this vhost (use 1-64 letters, digits, '-' or '_', unique per vhost)",
|
||||
route.id
|
||||
);
|
||||
route.source.validate()?;
|
||||
ensure!(
|
||||
|
||||
Reference in new issue
Block a user