{"record":{"id":"6cc21e4decdb8a16","repo":"XX-net/XX-Net","slug":"doh-request-no-name","errorCode":null,"errorMessage":"DoH request no name","messagePattern":"DoH request no name","errorType":"console","errorClass":null,"httpStatus":400,"severity":"warning","filePath":"code/default/smart_router/local/proxy_handler.py","lineNumber":379,"sourceCode":"            kv = parse_qs(parsed_url.query)\n            if parsed_url.path == \"/dns-query\":\n                return self.DoH_handler(kv)\n            else:\n                xlog.debug(\"PAC %s %s from:%s\", method, url, self.client_address)\n                handler = pac_server.PacHandler(self.conn, self.client_address, None, xlog)\n                return handler.handle()\n\n        sock = SocketWrap(self.conn, self.client_address[0], self.client_address[1])\n        sock.replace_pattern = [url[:url_prex_len], b\"\"]\n\n        xlog.debug(\"http %r connect to %s:%d %s %s\", self.client_address, host, port, method, path)\n        handle_domain_proxy(sock, host, port, self.client_address)\n\n    def DoH_handler(self, kv):\n        handler = pac_server.PacHandler(self.conn, self.client_address, None, xlog)\n        name = kv.get(\"name\", [None])[0]\n        if not name:\n            xlog.warn(\"DoH request no name\")\n            return handler.send_response(content=b'{\"error\":\"no name\"}', status=400)\n\n        dns_type = kv.get(\"type\", [\"1\"])[0]\n        if dns_type.isnumeric():\n            dns_type = int(dns_type)\n\n        ips = utils.to_str(g.dns_query.query(name, dns_type))\n        info = {\n            \"Status\": 0,\n            \"Answer\": [\n            ]\n        }\n        for ip in ips:\n            if dns_type == 1 and not utils.check_ip_valid4(ip):\n                continue\n            if dns_type == 16 and not utils.check_ip_valid6(ip):\n                continue\n","sourceCodeStart":361,"sourceCodeEnd":397,"githubUrl":"https://github.com/XX-net/XX-Net/blob/cfa5bc17b67676e467f37ec50766127e0ab5f0aa/code/default/smart_router/local/proxy_handler.py#L361-L397","documentation":"The DoH (DNS-over-HTTPS) endpoint was called without a 'name' query parameter. proxy_handler.DoH_handler serves DNS lookups and requires ?name=<domain>; when the parameter is missing it logs this warning and returns HTTP 400 with body {\"error\":\"no name\"} (it does not raise).","triggerScenarios":"GET /dns-query (or the DoH route) without ?name=..., e.g. a health-check probe, browser sending only ?type=A, or a misconstructed DoH client URL.","commonSituations":"Monitoring/load-balancer probes hitting the DoH endpoint, clients following RFC 8484 binary DoH (no name param) against this JSON-style API, typos in parameter names.","solutions":["Always include the name parameter: /dns-query?name=example.com","For monitoring probes, point health checks at a different endpoint or include a dummy name","If you need RFC 8484 wire-format DoH, use a dedicated DoH server — this handler expects name/type query params"],"exampleFix":"# before\nGET /dns-query\n\n# after\nGET /dns-query?name=example.com&type=1","handlingStrategy":"validation","validationCode":"name = kv.get('name',[None])[0]\nif not name:\n    return handler.send_response(content=b'{\"error\":\"no name\"}', status=400)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include ?name=<domain> on DoH requests","Point health checks at a dedicated endpoint or add a name param"],"tags":["doh","dns","missing-parameter","http-400"],"backgroundTag":"missing-required-parameter","analyzedSha":"cfa5bc17b67676e467f37ec50766127e0ab5f0aa","analyzedAt":"2026-08-27T19:28:28.225Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}