config: unite all Err directives

Signed-off-by: Nicolás A. Ortega Froysa <nicolas.ortega@zevenet.com>
This commit is contained in:
Nicolás A. Ortega Froysa 2023-05-16 13:09:18 +02:00
parent 31b29ba7dc
commit 43e334196b
57 changed files with 417 additions and 77 deletions

View File

@ -277,30 +277,18 @@ is customary for them to be at the start. They may appear in any order.
Define the response given when a request is rejected by WAF. If a code is
specified then the file contents will only be used for WAF responses using
that status code. If a code is unspecified then it will be used as a general
response for all WAF rejection responses.
Default:
"The request was rejected by the server.". Maximum file size: 4KB.
response for all WAF rejection responses. Default: "The request was rejected
by the server.". Maximum file size: 4KB.
* **Err414** "filename"
* **Err** \<code\> "filename"
A file with the text to be displayed if an Error 414 occurs. Default:
"Request URI is too long.". Maximum file size: 4KB.
Define a response message given when the proxy returns a specified error
response. The maximum file size is 4KB. The default responses are as follows:
* **Err500** "filename"
A file with the text to be displayed if an Error 500 occurs. Default: "An
internal server error occurred. Please try again later.". Maximum file size:
4KB.
* **Err501** "filename"
A file with the text to be displayed if an Error 501 occurs. Default: "This
method may not be used.". Maximum file size: 4KB.
* **Err503** "filename"
A file with the text to be displayed if an Error 503 occurs. Default: "The
service is not available. Please try again later.". Maximum file size: 4KB.
* 414 response: "Request URI is too long."
* 500 response: "An internal server error occurred. Please try again later."
* 501 response: "This method may not be used."
* 503 response: "The service is not available. Please try again later."
* **ErrNoSsl** [code] "filename"

View File

@ -298,13 +298,8 @@ struct cert_path {
* @param header.rw_destination rewrite destination header
* @param header.rw_host rewrite host header
* @param error.parse_req_msg ?
* @param error.err414 ?
* @param error.err500 ?
* @param error.err501 ?
* @param error.err503 ?
* @param error.errnossl ?
* @param error.nossl_url ?
* @param error.errwaf ?
* @param runtime.waf_rules ?
* @param runtime.ssl_dh_params ?
* @param runtime.ssl_ecdh_curve_nid ?
@ -361,11 +356,8 @@ struct zproxy_proxy_cfg {
struct {
char parse_req_msg[CONFIG_MAXBUF];
char err414_path[PATH_MAX];
char err500_path[PATH_MAX];
char err501_path[PATH_MAX];
char err503_path[PATH_MAX];
char errnossl_path[PATH_MAX];
struct list_head err_msgs;
struct list_head errwaf_msgs;
char nosslredirect_url[PATH_MAX];
enum ws_responses nosslredirect_code;
@ -375,10 +367,6 @@ struct zproxy_proxy_cfg {
struct list_head waf_rule_paths;
struct {
char err414_msg[CONFIG_MAXBUF];
char err500_msg[CONFIG_MAXBUF];
char err501_msg[CONFIG_MAXBUF];
char err503_msg[CONFIG_MAXBUF];
char errnossl_msg[CONFIG_MAXBUF];
void *waf_rules;
regex_t req_url_pat_reg;

View File

@ -76,10 +76,7 @@
#define CONFIG_REGEX_CheckURL "^[ \t]*CheckURL[ \t]+\"(.+)\"[ \t]*$"
#define CONFIG_REGEX_SSLConfigFile "^[ \t]*SSLConfigFile[ \t]+\"(.+)\"[ \t]*$"
#define CONFIG_REGEX_ErrNoSsl "^[ \t]*ErrNoSsl[ \t]+([45][0-9][0-9][ \t]+)?\"(.+)\"[ \t]*$"
#define CONFIG_REGEX_Err414 "^[ \t]*Err414[ \t]+\"(.+)\"[ \t]*$"
#define CONFIG_REGEX_Err500 "^[ \t]*Err500[ \t]+\"(.+)\"[ \t]*$"
#define CONFIG_REGEX_Err501 "^[ \t]*Err501[ \t]+\"(.+)\"[ \t]*$"
#define CONFIG_REGEX_Err503 "^[ \t]*Err503[ \t]+\"(.+)\"[ \t]*$"
#define CONFIG_REGEX_Err "^[ \t]*Err[ \t]*([345][0-9][0-9])[ \t]+\"(.+)\"[ \t]*$"
#define CONFIG_REGEX_NoSslRedirect "^[ \t]*NoSslRedirect[ \t]+(30[127][ \t]+)?\"(.+)\"[ \t]*$"
#define CONFIG_REGEX_SSLConfigSection "^[ \t]*SSLConfigSection[ \t]+([^ \t]+)[ \t]*$"
#define CONFIG_REGEX_MaxRequest "^[ \t]*MaxRequest[ \t]+([1-9][0-9]*)[ \t]*$"
@ -245,6 +242,7 @@ static void zproxy_proxy_cfg_init(struct zproxy_cfg *cfg,
proxy->log_level = cfg->args.log_level;
proxy->error.errnossl_code = CONFIG_DEFAULT_ErrNoSsl_Code;
INIT_LIST_HEAD(&proxy->error.err_msgs);
INIT_LIST_HEAD(&proxy->error.errwaf_msgs);
INIT_LIST_HEAD(&proxy->waf_rule_paths);
INIT_LIST_HEAD(&proxy->runtime.replace_header_req);
@ -1169,6 +1167,12 @@ static void _zproxy_proxy_cfg_free(struct zproxy_cfg *cfg,
free(waf_path);
}
list_for_each_entry_safe(err_item, err_next,
&proxy->error.err_msgs, list) {
list_del(&err_item->list);
free(err_item);
}
list_for_each_entry_safe(err_item, err_next,
&proxy->error.errwaf_msgs, list) {
list_del(&err_item->list);
@ -1233,22 +1237,6 @@ static int zproxy_proxy_cfg_prepare(struct zproxy_proxy_cfg *proxy)
struct matcher *tmp_matcher;
struct cert_path *path;
if (zproxy_cfg_errmsg_file(proxy->error.err414_path,
proxy->runtime.err414_msg) < 0)
return -1;
if (zproxy_cfg_errmsg_file(proxy->error.err500_path,
proxy->runtime.err500_msg) < 0)
return -1;
if (zproxy_cfg_errmsg_file(proxy->error.err501_path,
proxy->runtime.err501_msg) < 0)
return -1;
if (zproxy_cfg_errmsg_file(proxy->error.err503_path,
proxy->runtime.err503_msg) < 0)
return -1;
if (proxy->error.errnossl_path[0] == '\0') {
snprintf(proxy->runtime.errnossl_msg, CONFIG_MAXBUF, "%s",
CONFIG_DEFAULT_ErrNoSsl);
@ -1258,6 +1246,12 @@ static int zproxy_proxy_cfg_prepare(struct zproxy_proxy_cfg *proxy)
return -1;
}
list_for_each_entry(err_item, &proxy->error.err_msgs, list) {
if (zproxy_cfg_errmsg_file(err_item->path,
err_item->data) < 0)
return -1;
}
list_for_each_entry(err_item, &proxy->error.errwaf_msgs, list) {
if (zproxy_cfg_errmsg_file(err_item->path,
err_item->data) < 0)
@ -1460,18 +1454,26 @@ static int zproxy_proxy_cfg_file(struct zproxy_cfg *cfg, struct zproxy_proxy_cfg
parse_error("CheckURL multiple pattern");
lin[matches[1].rm_eo] = '\0';
snprintf(proxy->request.url_pat_str, CONFIG_IDENT_MAX, "%s", lin + matches[1].rm_so);
} else if (zproxy_regex_exec(CONFIG_REGEX_Err414, lin, matches)) {
} else if (zproxy_regex_exec(CONFIG_REGEX_Err, lin, matches)) {
struct err_resp_item *err_item =
(struct err_resp_item*)calloc(1, sizeof(struct err_resp_item));
if (!err_item)
parse_error("Failed to allocate memory (OOM).");
lin[matches[1].rm_eo] = '\0';
snprintf(proxy->error.err414_path, PATH_MAX, "%s", lin + matches[1].rm_so);
} else if (zproxy_regex_exec(CONFIG_REGEX_Err500, lin, matches)) {
lin[matches[1].rm_eo] = '\0';
snprintf(proxy->error.err500_path, PATH_MAX, "%s", lin + matches[1].rm_so);
} else if (zproxy_regex_exec(CONFIG_REGEX_Err501, lin, matches)) {
lin[matches[1].rm_eo] = '\0';
snprintf(proxy->error.err501_path, PATH_MAX, "%s", lin + matches[1].rm_so);
} else if (zproxy_regex_exec(CONFIG_REGEX_Err503, lin, matches)) {
lin[matches[1].rm_eo] = '\0';
snprintf(proxy->error.err503_path, PATH_MAX, "%s", lin + matches[1].rm_so);
err_item->code = (int)strtol(lin + matches[1].rm_so,
NULL, 10);
if (!IN_RANGE(err_item->code, 300, 599)) {
free(err_item);
parse_error("Invalid status code. Range is 300-599");
}
lin[matches[2].rm_eo] = '\0';
snprintf(err_item->path, PATH_MAX, "%s",
lin + matches[2].rm_so);
list_add_tail(&err_item->list,
&proxy->error.err_msgs);
} else if (zproxy_regex_exec(CONFIG_REGEX_ErrNoSsl, lin, matches)) {
if (matches[1].rm_eo != matches[1].rm_so) {
lin[matches[1].rm_eo] = '\0';
@ -1687,6 +1689,7 @@ zproxy_proxy_cfg_clone(const struct zproxy_proxy_cfg *proxy_cfg,
new_proxy->cfg = cfg;
INIT_LIST_HEAD(&new_proxy->service_list);
INIT_LIST_HEAD(&new_proxy->ssl.cert_paths);
INIT_LIST_HEAD(&new_proxy->error.err_msgs);
INIT_LIST_HEAD(&new_proxy->error.errwaf_msgs);
INIT_LIST_HEAD(&new_proxy->waf_rule_paths);
INIT_LIST_HEAD(&new_proxy->runtime.ssl_certs);
@ -1695,6 +1698,17 @@ zproxy_proxy_cfg_clone(const struct zproxy_proxy_cfg *proxy_cfg,
INIT_LIST_HEAD(&new_proxy->runtime.replace_header_req);
INIT_LIST_HEAD(&new_proxy->runtime.replace_header_res);
list_for_each_entry(err_item, &proxy_cfg->error.err_msgs, list) {
struct err_resp_item *new_err_item =
(struct err_resp_item*)calloc(1, sizeof(struct err_resp_item));
if (!new_err_item)
goto err_cert_path;
*new_err_item = *err_item;
list_add_tail(&new_err_item->list,
&new_proxy->error.err_msgs);
}
list_for_each_entry(err_item, &proxy_cfg->error.errwaf_msgs, list) {
struct err_resp_item *new_err_item =
(struct err_resp_item*)calloc(1, sizeof(struct err_resp_item));

View File

@ -61,12 +61,16 @@ int zproxy_http_request_reconnect(struct zproxy_http_ctx *ctx)
stream->request, stream->client_addr, stream->session,
static_cast<struct zproxy_http_state*>(ctx->state));
if (backend == nullptr) {
const char *html_msg =
zproxy_cfg_get_errmsg(&ctx->stream->listener_config->error.err_msgs, 503);
if (!html_msg)
html_msg = "";
ctx->resp_buf = http_manager::replyError(
stream, http::Code::ServiceUnavailable,
validation::request_result_reason.at(
validation::REQUEST_RESULT::
BACKEND_NOT_FOUND),
std::string(stream->listener_config->runtime.err503_msg));
html_msg);
return -1;
}
zproxy_set_backend(backend, ctx, stream);
@ -74,10 +78,14 @@ int zproxy_http_request_reconnect(struct zproxy_http_ctx *ctx)
stream->request.setHeaderSent(false);
ctx->buf_len = ctx->stream->request.prepareToSend(&buf);
if (ctx->buf_len == 0) {
const char *html_msg =
zproxy_cfg_get_errmsg(&ctx->stream->listener_config->error.err_msgs, 500);
if (!html_msg)
html_msg = "";
ctx->resp_buf = http_manager::replyError(
stream, http::Code::InternalServerError,
http::reasonPhrase(http::Code::InternalServerError),
std::string(stream->listener_config->runtime.err500_msg));
html_msg);
return -1;
}
ctx->buf = buf;
@ -116,10 +124,14 @@ static int zproxy_http_request_head_rcv(struct zproxy_http_ctx *ctx)
return 0;
}
if (parse_status == http_parser::PARSE_RESULT::TOOLONG) {
const char *html_msg =
zproxy_cfg_get_errmsg(&stream->listener_config->error.err_msgs, 414);
if (!html_msg)
html_msg = "";
ctx->resp_buf = http_manager::replyError(
stream, http::Code::URITooLong,
http::reasonPhrase(http::Code::URITooLong),
std::string(stream->listener_config->runtime.err414_msg));
html_msg);
return -1;
}
if (parse_status == http_parser::PARSE_RESULT::FAILED) {
@ -133,16 +145,24 @@ static int zproxy_http_request_head_rcv(struct zproxy_http_ctx *ctx)
auto valid = http_manager::validateRequestLine(stream);
if (valid == validation::REQUEST_RESULT::METHOD_NOT_ALLOWED) {
const char *html_msg =
zproxy_cfg_get_errmsg(&stream->listener_config->error.err_msgs, 501);
if (!html_msg)
html_msg = "";
ctx->resp_buf = http_manager::replyError(
stream, http::Code::MethodNotAllowed,
validation::request_result_reason.at(valid),
std::string(stream->listener_config->runtime.err501_msg));
html_msg);
return -1;
} else if (valid != validation::REQUEST_RESULT::OK) {
const char *html_msg =
zproxy_cfg_get_errmsg(&stream->listener_config->error.err_msgs, 503);
if (!html_msg)
html_msg = "";
ctx->resp_buf = http_manager::replyError(
stream, http::Code::ServiceUnavailable,
validation::request_result_reason.at(valid),
std::string(stream->listener_config->runtime.err503_msg));
html_msg);
return -1;
}
@ -160,11 +180,15 @@ static int zproxy_http_request_head_rcv(struct zproxy_http_ctx *ctx)
}
if (stream->service_config == nullptr) {
const char *html_msg =
zproxy_cfg_get_errmsg(&stream->listener_config->error.err_msgs, 503);
if (!html_msg)
html_msg = "";
ctx->resp_buf = http_manager::replyError(
stream, http::Code::ServiceUnavailable,
validation::request_result_reason.at(
validation::REQUEST_RESULT::SERVICE_NOT_FOUND),
std::string(stream->listener_config->runtime.err503_msg));
html_msg);
return -1;
}
@ -179,10 +203,14 @@ static int zproxy_http_request_head_rcv(struct zproxy_http_ctx *ctx)
valid = http_manager::validateRequest(stream);
if (valid != validation::REQUEST_RESULT::OK) {
const char *html_msg =
zproxy_cfg_get_errmsg(&stream->listener_config->error.err_msgs, 501);
if (!html_msg)
html_msg = "";
ctx->resp_buf = http_manager::replyError(
stream, http::Code::NotImplemented,
validation::request_result_reason.at(valid),
std::string(stream->listener_config->runtime.err501_msg));
html_msg);
return -1;
}
@ -201,12 +229,16 @@ static int zproxy_http_request_head_rcv(struct zproxy_http_ctx *ctx)
stream->request, stream->client_addr, stream->session,
state);
if (backend == nullptr) {
const char *html_msg =
zproxy_cfg_get_errmsg(&stream->listener_config->error.err_msgs, 503);
if (!html_msg)
html_msg = "";
ctx->resp_buf = http_manager::replyError(
stream, http::Code::ServiceUnavailable,
validation::request_result_reason.at(
validation::REQUEST_RESULT::
BACKEND_NOT_FOUND),
std::string(stream->listener_config->runtime.err503_msg));
html_msg);
return -1;
}
stream->new_backend = backend;
@ -226,10 +258,14 @@ static int zproxy_http_request_head_rcv(struct zproxy_http_ctx *ctx)
ctx->buf_len = ctx->stream->request.prepareToSend(&buf);
if (ctx->buf_len == 0) {
const char *html_msg =
zproxy_cfg_get_errmsg(&stream->listener_config->error.err_msgs, 500);
if (!html_msg)
html_msg = "";
ctx->resp_buf = http_manager::replyError(
ctx->stream, http::Code::InternalServerError,
http::reasonPhrase(http::Code::InternalServerError),
std::string(ctx->stream->listener_config->runtime.err500_msg));
html_msg);
return -1;
}
ctx->buf_tail_len = ctx->buf_len;
@ -267,10 +303,14 @@ static int zproxy_http_request_100_cont(struct zproxy_http_ctx *ctx)
ctx->buf_len = ctx->stream->request.prepareToSend(&buf);
if (ctx->buf_len == 0) {
const char *html_msg =
zproxy_cfg_get_errmsg(&ctx->stream->listener_config->error.err_msgs, 500);
if (!html_msg)
html_msg = "";
ctx->resp_buf = http_manager::replyError(
ctx->stream, http::Code::InternalServerError,
http::reasonPhrase(http::Code::InternalServerError),
std::string(ctx->stream->listener_config->runtime.err500_msg));
html_msg);
return -1;
}
ctx->buf_tail_len = ctx->buf_len;
@ -393,10 +433,14 @@ int zproxy_http_response_parser(struct zproxy_http_ctx *ctx)
if (parse_status == http_parser::PARSE_RESULT::INCOMPLETE)
return 0;
if (parse_status == http_parser::PARSE_RESULT::FAILED) {
const char *html_msg =
zproxy_cfg_get_errmsg(&ctx->stream->listener_config->error.err_msgs, 500);
if (!html_msg)
html_msg = "";
ctx->buf = http_manager::replyError(
stream, http::Code::InternalServerError,
http::reasonPhrase(http::Code::InternalServerError),
std::string(stream->listener_config->runtime.err500_msg));
html_msg);
ctx->buf_len = strlen(ctx->buf);
return -1;
}
@ -411,10 +455,14 @@ int zproxy_http_response_parser(struct zproxy_http_ctx *ctx)
// build the response
ctx->buf_len = ctx->stream->response.prepareToSend(&buf);
if (ctx->buf_len == 0) {
const char *html_msg =
zproxy_cfg_get_errmsg(&ctx->stream->listener_config->error.err_msgs, 500);
if (!html_msg)
html_msg = "";
ctx->buf = http_manager::replyError(
ctx->stream, http::Code::InternalServerError,
http::reasonPhrase(http::Code::InternalServerError),
std::string(ctx->stream->listener_config->runtime.err500_msg));
html_msg);
ctx->buf_len = strlen(ctx->buf);
return -1;
}

View File

@ -0,0 +1,25 @@
CMD=curl
CL=1
METHOD="GET"
URL="/"
#########################
CMD=ctl
URL="/listener/0"
METHOD="GET"
#########################
CMD=reload
FILE=zproxy_err.cfg
#########################
CMD=curl
CL=1
METHOD="GET"
URL="/"
#########################
DESCRIPTION="Test with a directive that is backwards compatible"
CMD=reload
FILE=zproxy_err_compat.cfg
#########################
CMD=curl
CL=1
METHOD="GET"
URL="/"

View File

@ -0,0 +1,7 @@
<html>
<head><title>503 no backend</title></head>
<body bgcolor="white">
<center><h1>503 no backend</h1></center>
<hr><center>zproxy</center>
</body>
</html>

View File

@ -0,0 +1 @@
ip netns exec cl-ns-1 /usr/bin/curl -X GET --connect-timeout 2 -s -k --show-error -w 'HTTP_VERSION: %{http_version}\n' -D test_1_curl/response_headers.out.tmp -o test_1_curl/body.out.tmp http://10.1.2.1:80/ >test_1_curl/extended.out.tmp 2>test_1_curl/error.out.tmp

View File

@ -0,0 +1 @@
HTTP_VERSION: 1.0

View File

@ -0,0 +1,8 @@
HTTP/1.0 503 no backend
Content-Type: text/html
Content-Length: #######
Expires: now
Pragma: no-cache
Server: zproxy
Cache-control: no-cache,no-store

View File

@ -0,0 +1,42 @@
{
"3xx-code-hits": 0,
"4xx-code-hits": 0,
"5xx-code-hits": 1,
"address": "0.0.0.0",
"connections": 0,
"https": false,
"id": 0,
"name": "env",
"pending-connections": 0,
"port": 80,
"services": [
{
"backends": [
{
"2xx-code-hits": 0,
"3xx-code-hits": 0,
"4xx-code-hits": 0,
"5xx-code-hits": 0,
"address": "127.0.0.1",
"connect-time": "#######",
"connections": 0,
"connections-limit": 0,
"https": false,
"id": "127.0.0.1-9999",
"pending-connections": 0,
"port": 9999,
"priority": 1,
"response-time": "#######",
"status": "down",
"type": 0,
"nfmark": 0,
"weight": 1
}
],
"name": "default",
"priority": 2,
"sessions": []
}
],
"waf-hits": 0
}

View File

@ -0,0 +1 @@
ip netns exec proxy-ns /usr/bin/curl -X GET --connect-timeout 2 -s -k --show-error -w 'HTTP_VERSION: %{http_version}\n' -D test_2_ctl/response_headers.out.tmp -o test_2_ctl/body.out.tmp --unix-socket /tmp/zproxy_ctl.sock http://localhost/listener/0 >test_2_ctl/extended.out.tmp 2>test_2_ctl/error.out.tmp

View File

@ -0,0 +1 @@
HTTP_VERSION: 1.1

View File

@ -0,0 +1,8 @@
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: #######
Expires: now
Pragma: no-cache
Server: zproxy/VERSION
Cache-control: no-cache,no-store

View File

@ -0,0 +1,3 @@
{
"result": "ok"
}

View File

@ -0,0 +1 @@
ip netns exec proxy-ns /usr/bin/curl -X PATCH --connect-timeout 2 -s -k --show-error -w 'HTTP_VERSION: %{http_version}\n' -D test_3_reload/response_headers.out.tmp -o test_3_reload/body.out.tmp --unix-socket /tmp/zproxy_ctl.sock http://localhost/config >test_3_reload/extended.out.tmp 2>test_3_reload/error.out.tmp

View File

@ -0,0 +1 @@
HTTP_VERSION: 1.1

View File

@ -0,0 +1,8 @@
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: #######
Expires: now
Pragma: no-cache
Server: zproxy/VERSION
Cache-control: no-cache,no-store

View File

@ -0,0 +1,29 @@
[
{
"backends": [
{
"2xx-code-hits": 0,
"3xx-code-hits": 0,
"4xx-code-hits": 0,
"5xx-code-hits": 0,
"address": "127.0.0.1",
"connect-time": "#######",
"connections": 0,
"connections-limit": 0,
"https": false,
"id": "127.0.0.1-9999",
"pending-connections": 0,
"port": 9999,
"priority": 1,
"response-time": "#######",
"status": "down",
"type": 0,
"nfmark": 0,
"weight": 1
}
],
"name": "default",
"priority": 2,
"sessions": []
}
]

View File

@ -0,0 +1 @@
ip netns exec proxy-ns /usr/bin/curl -X GET --connect-timeout 2 -s -k --show-error -w 'HTTP_VERSION: %{http_version}\n' -D test_3_reload_dump/response_headers.out.tmp -o test_3_reload_dump/body.out.tmp --unix-socket /tmp/zproxy_ctl.sock http://localhost/listener/0/services >test_3_reload_dump/extended.out.tmp 2>test_3_reload_dump/error.out.tmp

View File

@ -0,0 +1 @@
HTTP_VERSION: 1.1

View File

@ -0,0 +1,8 @@
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: #######
Expires: now
Pragma: no-cache
Server: zproxy/VERSION
Cache-control: no-cache,no-store

View File

@ -0,0 +1,2 @@
Custom 503 error

View File

@ -0,0 +1 @@
ip netns exec cl-ns-1 /usr/bin/curl -X GET --connect-timeout 2 -s -k --show-error -w 'HTTP_VERSION: %{http_version}\n' -D test_4_curl/response_headers.out.tmp -o test_4_curl/body.out.tmp http://10.1.2.1:80/ >test_4_curl/extended.out.tmp 2>test_4_curl/error.out.tmp

View File

@ -0,0 +1 @@
HTTP_VERSION: 1.0

View File

@ -0,0 +1,8 @@
HTTP/1.0 503 no backend
Content-Type: text/html
Content-Length: #######
Expires: now
Pragma: no-cache
Server: zproxy
Cache-control: no-cache,no-store

View File

@ -0,0 +1,3 @@
{
"result": "ok"
}

View File

@ -0,0 +1 @@
ip netns exec proxy-ns /usr/bin/curl -X PATCH --connect-timeout 2 -s -k --show-error -w 'HTTP_VERSION: %{http_version}\n' -D test_5_reload/response_headers.out.tmp -o test_5_reload/body.out.tmp --unix-socket /tmp/zproxy_ctl.sock http://localhost/config >test_5_reload/extended.out.tmp 2>test_5_reload/error.out.tmp

View File

@ -0,0 +1 @@
HTTP_VERSION: 1.1

View File

@ -0,0 +1,8 @@
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: #######
Expires: now
Pragma: no-cache
Server: zproxy/VERSION
Cache-control: no-cache,no-store

View File

@ -0,0 +1,29 @@
[
{
"backends": [
{
"2xx-code-hits": 0,
"3xx-code-hits": 0,
"4xx-code-hits": 0,
"5xx-code-hits": 0,
"address": "127.0.0.1",
"connect-time": "#######",
"connections": 0,
"connections-limit": 0,
"https": false,
"id": "127.0.0.1-9999",
"pending-connections": 0,
"port": 9999,
"priority": 1,
"response-time": "#######",
"status": "down",
"type": 0,
"nfmark": 0,
"weight": 1
}
],
"name": "default",
"priority": 2,
"sessions": []
}
]

View File

@ -0,0 +1 @@
ip netns exec proxy-ns /usr/bin/curl -X GET --connect-timeout 2 -s -k --show-error -w 'HTTP_VERSION: %{http_version}\n' -D test_5_reload_dump/response_headers.out.tmp -o test_5_reload_dump/body.out.tmp --unix-socket /tmp/zproxy_ctl.sock http://localhost/listener/0/services >test_5_reload_dump/extended.out.tmp 2>test_5_reload_dump/error.out.tmp

View File

@ -0,0 +1 @@
HTTP_VERSION: 1.1

View File

@ -0,0 +1,8 @@
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: #######
Expires: now
Pragma: no-cache
Server: zproxy/VERSION
Cache-control: no-cache,no-store

View File

@ -0,0 +1,2 @@
Custom 503 error

View File

@ -0,0 +1 @@
ip netns exec cl-ns-1 /usr/bin/curl -X GET --connect-timeout 2 -s -k --show-error -w 'HTTP_VERSION: %{http_version}\n' -D test_6_curl/response_headers.out.tmp -o test_6_curl/body.out.tmp http://10.1.2.1:80/ >test_6_curl/extended.out.tmp 2>test_6_curl/error.out.tmp

View File

@ -0,0 +1 @@
HTTP_VERSION: 1.0

View File

@ -0,0 +1,8 @@
HTTP/1.0 503 no backend
Content-Type: text/html
Content-Length: #######
Expires: now
Pragma: no-cache
Server: zproxy
Cache-control: no-cache,no-store

View File

@ -0,0 +1,25 @@
######################################################################
##GLOBAL OPTIONS
User "root"
Group "root"
LogLevel 7
Timeout 45
ConnTO 6
Alive 10
Client 30
ThreadModel dynamic
ListenHTTP
Name env
Address 0.0.0.0
Port #{PROXY_VPORT}
xHTTP 4
RewriteLocation 1
Service "default"
BackEnd
Address 127.0.0.1
Port #{BCK_CLOSED_PORT}
End
End
End

View File

@ -0,0 +1,27 @@
######################################################################
##GLOBAL OPTIONS
User "root"
Group "root"
LogLevel 7
Timeout 45
ConnTO 6
Alive 10
Client 30
ThreadModel dynamic
ListenHTTP
Name env
Address 0.0.0.0
Port #{PROXY_VPORT}
xHTTP 4
RewriteLocation 1
Err 503 "#{TEST_TPL}/err503.html"
Service "default"
BackEnd
Address 127.0.0.1
Port #{BCK_CLOSED_PORT}
End
End
End

View File

@ -0,0 +1,27 @@
######################################################################
##GLOBAL OPTIONS
User "root"
Group "root"
LogLevel 7
Timeout 45
ConnTO 6
Alive 10
Client 30
ThreadModel dynamic
ListenHTTP
Name env
Address 0.0.0.0
Port #{PROXY_VPORT}
xHTTP 4
RewriteLocation 1
Err503 "#{TEST_TPL}/err503.html"
Service "default"
BackEnd
Address 127.0.0.1
Port #{BCK_CLOSED_PORT}
End
End
End

View File

@ -0,0 +1 @@
Custom 503 error