diff --git a/README.md b/README.md index 38039c3..92cf9f2 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,8 @@ Attributes: port: Backend's listening port. (Default: 80) max_ips: IP buffer size. Maximum number of resolved IPs to cache. (Default: 4) interval: How many seconds to resolve domain name. (Default: 1) + max_fails: How many failures to allow before disabling + This is the same as round robin max_fails (Default: 1) ipver: Only addresses of family IPv4 or IPv6 will be used if defined (Default: 0) ignore_failure: Allow nginx to start even if resolution fails (1 to enable) (Default: 0) strict: Require the DNS resolution to succeed and return addresses, diff --git a/src/ngx_http_upstream_jdomain_module.c b/src/ngx_http_upstream_jdomain_module.c index b53c00d..db715f2 100644 --- a/src/ngx_http_upstream_jdomain_module.c +++ b/src/ngx_http_upstream_jdomain_module.c @@ -25,6 +25,7 @@ #define NGX_JDOMAIN_ARG_STR_PORT "port=" #define NGX_JDOMAIN_ARG_STR_IPVER "ipver=" #define NGX_JDOMAIN_ARG_STR_MAX_CONNS "max_conns=" +#define NGX_JDOMAIN_ARG_STR_MAX_FAILS "max_fails=" #define NGX_JDOMAIN_ARG_STR_STRICT "strict" typedef struct @@ -626,6 +627,14 @@ ngx_http_upstream_jdomain(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) continue; } + arglen = ngx_strlen(NGX_JDOMAIN_ARG_STR_MAX_FAILS); + if (ngx_strncmp(value[i].data, NGX_JDOMAIN_ARG_STR_MAX_FAILS, arglen) == 0) { + num = ngx_atoi(value[i].data + arglen, value[i].len - arglen); + server->max_fails = num; + + continue; + } + goto invalid; }