Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1 from section-io/jason-dns
Browse files Browse the repository at this point in the history
Handle DNS failures without disrupting HTTP traffic
  • Loading branch information
jstangroome authored Mar 8, 2018
2 parents b3ded6c + a6415b2 commit 8cf75b7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ngx_http_upstream_dynamic_servers.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,14 @@ ngx_http_upstream_dynamic_server_resolve_handler(ngx_resolver_ctx_t *ctx) {
if (ctx->state) {
ngx_log_error(NGX_LOG_ERR, ctx->resolver->log, 0, "upstream-dynamic-servers: '%V' could not be resolved (%i: %s)", &ctx->name, ctx->state, ngx_resolver_strerror(ctx->state));

// If the domain fails to resolve after a previously successful resolve
// then keep using the previous addresses and log a warning and try to
// resolve again on the next interval.
if (0 < dynamic_server->server->naddrs) {
ngx_log_error(NGX_LOG_WARN, ctx->resolver->log, 0, "upstream-dynamic-servers: Retaining last successful DNS results for '%V'", &ctx->name);
goto end;
}

ngx_url_t u;
ngx_memzero(&u, sizeof(ngx_url_t));

Expand Down

0 comments on commit 8cf75b7

Please sign in to comment.