From ad7884f2f65adc3c2965552cc7be66450c5b11c9 Mon Sep 17 00:00:00 2001 From: Razvan Dimescu Date: Thu, 2 Apr 2026 17:50:22 +0300 Subject: [PATCH] fix: add numa search domain on install for browser compatibility Chrome treats single-label TLDs (e.g. frontend.numa) as search queries unless a trailing slash is added. Adding "numa" as a search domain tells the OS resolver that .numa is valid, so browsers resolve it directly. macOS: networksetup -setsearchdomains, cleared on uninstall Linux (resolved): Domains=~. numa in drop-in Linux (resolv.conf): search numa Co-Authored-By: Claude Opus 4.6 (1M context) --- src/system_dns.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/system_dns.rs b/src/system_dns.rs index 11fbd1e..a172608 100644 --- a/src/system_dns.rs +++ b/src/system_dns.rs @@ -776,7 +776,7 @@ fn install_macos() -> Result<(), String> { .map_err(|e| format!("failed to serialize backup: {}", e))?; std::fs::write(backup_path(), json).map_err(|e| format!("failed to write backup: {}", e))?; - // Set DNS to 127.0.0.1 for each service + // Set DNS to 127.0.0.1 and add "numa" search domain for each service for service in &services { let status = std::process::Command::new("networksetup") .args(["-setdnsservers", service, "127.0.0.1"]) @@ -788,6 +788,11 @@ fn install_macos() -> Result<(), String> { } else { eprintln!(" warning: failed to set DNS for \"{}\"", service); } + + // Add "numa" as search domain so browsers resolve .numa without trailing slash + let _ = std::process::Command::new("networksetup") + .args(["-setsearchdomains", service, "numa"]) + .status(); } eprintln!("\n Original DNS saved to {}", backup_path().display()); @@ -832,6 +837,11 @@ fn uninstall_macos() -> Result<(), String> { } else { eprintln!(" warning: failed to restore DNS for \"{}\"", service); } + + // Clear the "numa" search domain + let _ = std::process::Command::new("networksetup") + .args(["-setsearchdomains", service, "Empty"]) + .status(); } std::fs::remove_file(&path).ok(); @@ -1092,7 +1102,7 @@ fn install_linux() -> Result<(), String> { let drop_in = resolved_dir.join("numa.conf"); std::fs::write( &drop_in, - "[Resolve]\nDNS=127.0.0.1\nDomains=~.\nDNSStubListener=no\n", + "[Resolve]\nDNS=127.0.0.1\nDomains=~. numa\nDNSStubListener=no\n", ) .map_err(|e| format!("failed to write {}: {}", drop_in.display(), e))?; @@ -1130,7 +1140,7 @@ fn install_linux() -> Result<(), String> { } let content = - "# Generated by Numa — run 'sudo numa uninstall' to restore\nnameserver 127.0.0.1\n"; + "# Generated by Numa — run 'sudo numa uninstall' to restore\nnameserver 127.0.0.1\nsearch numa\n"; std::fs::write(resolv, content) .map_err(|e| format!("failed to write /etc/resolv.conf: {}", e))?;