*) check a proxy_redirect single parameter

*) warn about "proxy_redirect false"
This commit is contained in:
Igor Sysoev 2009-04-30 12:43:38 +00:00
parent 5461f39381
commit 06d4aa1883

View File

@ -2675,10 +2675,26 @@ ngx_http_proxy_redirect(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
value = cf->args->elts; value = cf->args->elts;
if (ngx_strcmp(value[1].data, "off") == 0) { if (cf->args->nelts == 2) {
plcf->redirect = 0; if (ngx_strcmp(value[1].data, "off") == 0) {
plcf->redirects = NULL; plcf->redirect = 0;
return NGX_CONF_OK; plcf->redirects = NULL;
return NGX_CONF_OK;
}
if (ngx_strcmp(value[1].data, "false") == 0) {
ngx_conf_log_error(NGX_LOG_ERR, cf, 0,
"invalid parameter \"false\", use \"off\" instead");
plcf->redirect = 0;
plcf->redirects = NULL;
return NGX_CONF_OK;
}
if (ngx_strcmp(value[1].data, "default") != 0) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"invalid parameter \"%V\"", &value[1]);
return NGX_CONF_ERROR;
}
} }
if (plcf->redirects == NULL) { if (plcf->redirects == NULL) {
@ -2694,7 +2710,7 @@ ngx_http_proxy_redirect(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
return NGX_CONF_ERROR; return NGX_CONF_ERROR;
} }
if (cf->args->nelts == 2 && ngx_strcmp(value[1].data, "default") == 0) { if (ngx_strcmp(value[1].data, "default") == 0) {
if (plcf->url.data == NULL) { if (plcf->url.data == NULL) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"\"proxy_rewrite_location default\" must go " "\"proxy_rewrite_location default\" must go "