mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-02-27 17:00:45 +01:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user