[core] Proxy socket: compile option proxy_socket gives both engines a 0660 Unix socket for the front proxy (edge in its config, Caddy a third server with trusted_proxies_unix); listeners change only with a restart
This commit is contained in:
@@ -112,6 +112,8 @@ pub struct EdgeSpec<'a> {
|
||||
pub files: Vec<(String, Vec<u8>)>,
|
||||
/// Peers whose X-Forwarded-For edge believes.
|
||||
pub trusted_proxies: Vec<std::net::IpAddr>,
|
||||
/// The front proxy's Unix socket.
|
||||
pub proxy_socket: Option<String>,
|
||||
}
|
||||
|
||||
impl Default for EdgeSpec<'_> {
|
||||
@@ -125,6 +127,7 @@ impl Default for EdgeSpec<'_> {
|
||||
http_port: None,
|
||||
files: Vec::new(),
|
||||
trusted_proxies: Vec::new(),
|
||||
proxy_socket: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -195,6 +198,7 @@ pub fn spawn(spec: EdgeSpec<'_>) -> Edge {
|
||||
caddy_admin: None,
|
||||
caddy_admin_socket: None,
|
||||
trusted_proxies: spec.trusted_proxies.clone(),
|
||||
proxy_socket: spec.proxy_socket.clone(),
|
||||
};
|
||||
let config_text = compile_with(&dir, &ca, &opts, spec.site, &spec.hosts);
|
||||
std::fs::write(dir.join("edge.json"), &config_text).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user