mirror of
https://github.com/nginx/nginx.git
synced 2024-12-18 21:23:36 -06:00
allow override redirect status in error_page
This commit is contained in:
parent
c5d1790e1d
commit
a64b716b22
@ -4069,19 +4069,15 @@ ngx_http_core_error_page(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||||||
return NGX_CONF_ERROR;
|
return NGX_CONF_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (overwrite >= 0) {
|
err->overwrite = overwrite;
|
||||||
err->overwrite = overwrite;
|
|
||||||
|
|
||||||
} else {
|
if (overwrite == -1) {
|
||||||
switch (err->status) {
|
switch (err->status) {
|
||||||
case NGX_HTTP_TO_HTTPS:
|
case NGX_HTTP_TO_HTTPS:
|
||||||
case NGX_HTTPS_CERT_ERROR:
|
case NGX_HTTPS_CERT_ERROR:
|
||||||
case NGX_HTTPS_NO_CERT:
|
case NGX_HTTPS_NO_CERT:
|
||||||
err->overwrite = NGX_HTTP_BAD_REQUEST;
|
err->overwrite = NGX_HTTP_BAD_REQUEST;
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
err->overwrite = err->status;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -523,7 +523,9 @@ ngx_http_send_error_page(ngx_http_request_t *r, ngx_http_err_page_t *err_page)
|
|||||||
r->expect_tested = 1;
|
r->expect_tested = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
r->err_status = overwrite;
|
if (overwrite >= 0) {
|
||||||
|
r->err_status = overwrite;
|
||||||
|
}
|
||||||
|
|
||||||
if (ngx_http_complex_value(r, &err_page->value, &uri) != NGX_OK) {
|
if (ngx_http_complex_value(r, &err_page->value, &uri) != NGX_OK) {
|
||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
@ -556,7 +558,7 @@ ngx_http_send_error_page(ngx_http_request_t *r, ngx_http_err_page_t *err_page)
|
|||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
r->err_status = NGX_HTTP_MOVED_TEMPORARILY;
|
r->err_status = overwrite > 0 ? overwrite : NGX_HTTP_MOVED_TEMPORARILY;
|
||||||
|
|
||||||
location->hash = 1;
|
location->hash = 1;
|
||||||
ngx_str_set(&location->key, "Location");
|
ngx_str_set(&location->key, "Location");
|
||||||
@ -570,7 +572,7 @@ ngx_http_send_error_page(ngx_http_request_t *r, ngx_http_err_page_t *err_page)
|
|||||||
return ngx_http_send_refresh(r);
|
return ngx_http_send_refresh(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ngx_http_send_special_response(r, clcf, NGX_HTTP_MOVED_TEMPORARILY
|
return ngx_http_send_special_response(r, clcf, r->err_status
|
||||||
- NGX_HTTP_MOVED_PERMANENTLY
|
- NGX_HTTP_MOVED_PERMANENTLY
|
||||||
+ NGX_HTTP_LEVEL_200);
|
+ NGX_HTTP_LEVEL_200);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user