TechnitiumSoftware/DnsServer · warning · HttpRequestException

{httpResponse.StatusCode} {httpResponse.ReasonPhrase}

Error message

{httpResponse.StatusCode} {httpResponse.ReasonPhrase}

What it means

Thrown by the AdvancedBlockingApp block-list downloader when the HTTP response status is neither OK (200) nor NotModified (304). The default branch throws HttpRequestException carrying the status code and reason phrase. It is immediately caught by the surrounding try/catch, logged, and the method returns false so the app falls back to the previously cached list file.

Source

Thrown at Apps/AdvancedBlockingApp/App.cs:1244

                                    if (httpResponse.Content.Headers.LastModified is null)
                                    {
                                        _lastModified = DateTime.UtcNow;
                                    }
                                    else
                                    {
                                        _lastModified = httpResponse.Content.Headers.LastModified.Value.UtcDateTime;
                                        File.SetLastWriteTimeUtc(_listFilePath, _lastModified);
                                    }

                                    _dnsServer.WriteLog("Advanced Blocking app successfully downloaded " + (_isAdblockList ? "adblock" : (_isRegexList ? "regex " : "") + (_isAllowList ? "allow" : "block")) + " list (" + WebUtilities.GetFormattedSize(new FileInfo(_listFilePath).Length) + "): " + _listUrl.AbsoluteUri);
                                    return true;

                                case HttpStatusCode.NotModified:
                                    _dnsServer.WriteLog("Advanced Blocking app successfully checked for a new update of the " + (_isAdblockList ? "adblock" : (_isRegexList ? "regex " : "") + (_isAllowList ? "allow" : "block")) + " list: " + _listUrl.AbsoluteUri);
                                    return false;

                                default:
                                    throw new HttpRequestException((int)httpResponse.StatusCode + " " + httpResponse.ReasonPhrase);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    _dnsServer.WriteLog("Advanced Blocking app failed to download " + (_isAdblockList ? "adblock" : (_isRegexList ? "regex " : "") + (_isAllowList ? "allow" : "block")) + " list and will use previously downloaded file (if available): " + _listUrl.AbsoluteUri, ex);
                    return false;
                }
            }

            #endregion

            #region protected

            protected abstract void LoadListZone();

            #endregion

View on GitHub (pinned to d0484b6c1e)

Solutions

  1. Check the DNS server application log for the full status code and the failing list URL; verify the URL opens in a browser.
  2. If the host returns 403/429, switch to a mirror or official list URL, or add a longer update interval to reduce request frequency.
  3. Keep the previously downloaded list file in place so the app keeps serving blocks while the upstream recovers; the download auto-retries on the next update cycle.
Defensive patterns

Strategy: retry

Validate before calling

// Before treating a list URL as healthy, probe it. (The downloader already falls back to cache; this avoids config of dead URLs.)
using var http = new HttpClient();
using var resp = await http.GetAsync(listUrl, HttpCompletionOption.ResponseHeadersRead);
if (resp.StatusCode != HttpStatusCode.OK && resp.StatusCode != HttpStatusCode.NotModified)
    throw new InvalidOperationException($"List URL '{listUrl}' returned {(int)resp.StatusCode}; pick a reachable mirror.");

Try / catch

// The downloader already wraps this in try/catch and falls back to the cached file; surface it to the operator.
catch (HttpRequestException ex)
{
    _dnsServer.WriteLog($"Block list download failed for {_listUrl}: {ex.Message}; serving cached file.", ex);
}

Prevention

When it happens

Trigger: The list URL returns 403/404/429/500/502/503, or a redirect chain lands on an error page; a CDN WAF blocks the User-Agent; the server is temporarily down. The downloader retries on its configured interval and uses the cached file meanwhile.

Common situations: A block list moved or is now paywalled (404/403); rate-limited by a shared CDN (429); transient upstream outage (5xx); corporate proxy returning an error page.

Related errors


AI-assisted analysis of TechnitiumSoftware/DnsServer@d0484b6c1e (2026-08-13). Data as JSON: /api/errors/4687b716a4e27bf3. Report an issue: GitHub.