{"record":{"id":"978c020f10c330e9","repo":"TechnitiumSoftware/DnsServer","slug":"port-853-is-reserved-for-dns-over-tls-service-ple-978c02","errorCode":null,"errorMessage":"Port 853 is reserved for DNS-over-TLS service. Please use a different port for DNS-over-HTTPS service.","messagePattern":"Port 853 is reserved for DNS-over-TLS service\\. Please use a different port for DNS-over-HTTPS service\\.","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"DnsServerCore/Dns/DnsServer.cs","lineNumber":7792,"sourceCode":"                    throw new ArgumentOutOfRangeException(nameof(DnsOverTlsPort), \"Port 53 cannot be used for DNS-over-TLS service. Please use a different port.\");\n\n                _dnsOverTlsPort = value;\n            }\n        }\n\n        public int DnsOverHttpsPort\n        {\n            get { return _dnsOverHttpsPort; }\n            set\n            {\n                if ((value < ushort.MinValue) || (value > ushort.MaxValue))\n                    throw new ArgumentOutOfRangeException(nameof(DnsOverHttpsPort), \"Port number valid range is from 0 to 65535.\");\n\n                if (value == 53)\n                    throw new ArgumentOutOfRangeException(nameof(DnsOverHttpsPort), \"Port 53 cannot be used for DNS-over-HTTPS service. Please use a different port.\");\n\n                if (value == 853)\n                    throw new ArgumentOutOfRangeException(nameof(DnsOverHttpsPort), \"Port 853 is reserved for DNS-over-TLS service. Please use a different port for DNS-over-HTTPS service.\");\n\n                _dnsOverHttpsPort = value;\n            }\n        }\n\n        public int DnsOverQuicPort\n        {\n            get { return _dnsOverQuicPort; }\n            set\n            {\n                if ((value < ushort.MinValue) || (value > ushort.MaxValue))\n                    throw new ArgumentOutOfRangeException(nameof(DnsOverQuicPort), \"Port number valid range is from 0 to 65535.\");\n\n                if (value == 53)\n                    throw new ArgumentOutOfRangeException(nameof(DnsOverQuicPort), \"Port 53 cannot be used for DNS-over-QUIC service. Please use a different port.\");\n\n                _dnsOverQuicPort = value;\n            }","sourceCodeStart":7774,"sourceCodeEnd":7810,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/DnsServerCore/Dns/DnsServer.cs#L7774-L7810","documentation":"Thrown by the DnsOverHttpsPort setter when value == 853 (third and final guard, after range 314 and port-53 315 checks pass). Port 853 is reserved for DNS-over-TLS; DNS-over-HTTPS is not allowed to bind it, preventing a collision between the two encrypted transports.","triggerScenarios":"Assigning DnsServer.DnsOverHttpsPort = 853 via the settings API or config restore. The range and port-53 guards pass; this guard fires.","commonSituations":"Picking 853 for DoH believing it is a generic encrypted-DNS port. Colliding DoH and DoT configs during migration. Note this mirrors the DnsOverHttpPort 853 guard (311).","solutions":["Use 443 (or another free non-853 port) for DoH; reserve 853 for DoT.","If you want port 853, enable DNS-over-Tls and configure DnsOverTlsPort instead.","Pre-validate the DoH port is neither 53 nor 853 before assigning.","Re-submit the corrected port via the settings API."],"exampleFix":"// before\n_dnsServer.DnsOverHttpsPort = 853;  // throws: 853 reserved for DoT\n\n// after\n_dnsServer.DnsOverHttpsPort = 443;   // DoH on 443","handlingStrategy":"validation","validationCode":"if (parsed == 853) parsed = 443; // 853 reserved for DoT\n_dnsServer.DnsOverHttpsPort = parsed;","typeGuard":"static bool IsAcceptableDohsPort(int value) => value != 53 && value != 853 && value >= 0 && value <= 65535;","tryCatchPattern":"try { _dnsServer.DnsOverHttpsPort = parsed; }\ncatch (ArgumentOutOfRangeException ex) when (ex.ParamName == nameof(DnsServer.DnsOverHttpsPort) && parsed == 853)\n{ _dnsServer.DnsOverHttpsPort = 443; }","preventionTips":["Keep 853 exclusive to DoT; use 443 for DoH.","If 853 is needed, configure DnsOverTlsPort instead.","Validate DoH ports against {53, 853}."],"tags":["dns","network","port","dnsoverhttps","reserved-port","configuration","argumentoutofrange"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}