From f801edf86f79a4a8fe784753aef60b2645196431 Mon Sep 17 00:00:00 2001 From: master3395 Date: Sun, 22 Feb 2026 01:19:36 +0100 Subject: [PATCH] Cloudflare: auto-enable proxy except mail-related subdomains Expand mail-domain detection so proxy stays off for: mail., smtp., imap., pop3., pop., autodiscover., webmail. (and subdomains containing these). Other A/AAAA/CNAME get proxied by default. --- plogical/dnsUtilities.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plogical/dnsUtilities.py b/plogical/dnsUtilities.py index c3915dcc3..06a106fa8 100644 --- a/plogical/dnsUtilities.py +++ b/plogical/dnsUtilities.py @@ -717,10 +717,14 @@ class DNS: value = value.replace('"', '') # A, AAAA and CNAME records can be proxied in CloudFlare. - # Determine if proxy should be enabled (default: True, except for mail domains). + # Auto-enable proxy when Cloudflare is used, except for mail-related domains. if proxied is None and type in ['A', 'AAAA', 'CNAME']: - # Check if this is a mail domain (starts with 'mail.' or contains 'mail.') - is_mail_domain = name.lower().startswith('mail.') or '.mail.' in name.lower() + name_lower = name.lower() + mail_prefixes = ('mail.', 'smtp.', 'imap.', 'pop3.', 'pop.', 'autodiscover.', 'webmail.') + is_mail_domain = ( + any(name_lower.startswith(p) for p in mail_prefixes) or + any(f'.{p.rstrip(".")}.' in name_lower for p in mail_prefixes) + ) proxied = not is_mail_domain elif type not in ['A', 'AAAA', 'CNAME']: # MX, TXT, etc. cannot be proxied