diff --git a/platform/src/key_keeper.cpp b/platform/src/key_keeper.cpp
index d374bf4..dacb91d 100644
--- a/platform/src/key_keeper.cpp
+++ b/platform/src/key_keeper.cpp
@@ -490,8 +490,8 @@ struct key_keeper* key_keeper_init(const char * profile, const char* section, vo
MESA_load_profile_string_def(profile, section, "untrusted_ca_path", keeper->untrusted_ca_path, sizeof(keeper->untrusted_ca_path), "./conf/mesalab-ca.pem");
MESA_load_profile_string_def(profile, section, "cert_store_host", keeper->cert_store_host, sizeof(keeper->cert_store_host), "xxxxx");
MESA_load_profile_uint_def(profile, section, "cert_store_port", &(keeper->cert_store_port), 80);
- MESA_load_profile_uint_def(profile, section, "hash_slot_size", &(keeper->hash_slot_size), 16);
- MESA_load_profile_uint_def(profile, section, "hash_expire_seconds", &(keeper->hash_expire_seconds), 16);
+ MESA_load_profile_uint_def(profile, section, "hash_slot_size", &(keeper->hash_slot_size), 1024*128);
+ MESA_load_profile_uint_def(profile, section, "hash_expire_seconds", &(keeper->hash_expire_seconds), 5*60);
keeper->htable = create_hash_table(keeper->hash_slot_size, keeper->hash_expire_seconds);
TFE_LOG_INFO(logger, "MESA_load_profile, [%s]: mode:%s, ca_path:%s, untrusted_ca_path:%s, cert_store_host:%s, cert_store_port:%d, hash_slot_size:%d, hash_expire_seconds:%d",
section, keeper->mode, keeper->ca_path, keeper->untrusted_ca_path, keeper->cert_store_host, keeper->cert_store_port, keeper->hash_slot_size, keeper->hash_expire_seconds);
diff --git a/plugin/business/pangu-http/conf/template/HTTP403.html b/plugin/business/pangu-http/conf/template/HTTP403.html
index 1473af0..53821c5 100644
--- a/plugin/business/pangu-http/conf/template/HTTP403.html
+++ b/plugin/business/pangu-http/conf/template/HTTP403.html
@@ -1,12 +1,13 @@
+
We've got some trouble | 403 - Access Denied
- Access Denied Error 403
The requested resource requires an authentication (TFE-{{cfg_id}}).
+ Access Denied Error 403
The requested resource requires an authentication (TFE-{{cfg_id}}:{{msg}}).
diff --git a/plugin/business/pangu-http/conf/template/HTTP404.html b/plugin/business/pangu-http/conf/template/HTTP404.html
index ebaa2cd..2a89476 100644
--- a/plugin/business/pangu-http/conf/template/HTTP404.html
+++ b/plugin/business/pangu-http/conf/template/HTTP404.html
@@ -1,12 +1,13 @@
+
We've got some trouble | 404 - Resource not found
- Resource not found Error 404
The requested resource could not be found but may be available again in the future (TFE-{{cfg_id}}).
+ Resource not found Error 404
The requested resource could not be found but may be available again in the future (TFE-{{cfg_id}}:{{msg}}).
diff --git a/plugin/business/pangu-http/conf/template/HTTP451.html b/plugin/business/pangu-http/conf/template/HTTP451.html
index 1b40fa5..8fe9a15 100644
--- a/plugin/business/pangu-http/conf/template/HTTP451.html
+++ b/plugin/business/pangu-http/conf/template/HTTP451.html
@@ -1,4 +1,5 @@
+
@@ -6,7 +7,7 @@
- Unavailable For Legal Reasons Error 451
This request may not be serviced due to the regulations of your residency (TFE-{{cfg_id}}).
+ Unavailable For Legal Reasons Error 451
This request may not be serviced due to the regulations of your residency (TFE-{{cfg_id}}:{{msg}}).
diff --git a/plugin/business/pangu-http/pangu_http.cpp b/plugin/business/pangu-http/pangu_http.cpp
index 5244e52..9478f8f 100644
--- a/plugin/business/pangu-http/pangu_http.cpp
+++ b/plugin/business/pangu-http/pangu_http.cpp
@@ -364,10 +364,11 @@ static enum pangu_action decide_ctrl_action(const struct Maat_rule_t * hit_rules
return prior_action;
}
//HTML template is downloaded from https://github.com/AndiDittrich/HttpErrorPages
-static void html_generate(int cfg_id, int status_code, char ** page_buff, size_t * page_size)
+static void html_generate(int status_code, int cfg_id, const char* msg, char ** page_buff, size_t * page_size)
{
ctemplate::TemplateDictionary dict("pg_page_dict"); //dict is automatically finalized after function returned.
dict.SetIntValue("cfg_id", cfg_id);
+ dict.SetValue("msg", msg);
std::string output;
ctemplate::Template * tpl = NULL;
@@ -559,20 +560,23 @@ static void http_reject(const struct tfe_http_session * session, enum tfe_http_e
char * page_buff = NULL;
size_t page_size = 0;
- char cont_len_str[TFE_STRING_MAX];
+ char cont_len_str[16];
+ char msg[TFE_STRING_MAX];
struct tfe_http_session * to_write_sess = NULL;
- ret = sscanf(ctx->enforce_para, "code=%d;", &resp_code);
- if (ret != 1)
+ ret = sscanf(ctx->enforce_para, "code=%d;content=%s", &resp_code, msg);
+ if (ret != 2)
{
TFE_LOG_ERROR(g_pangu_rt->local_logger, "Invalid reject rule %d paramter %s",
- ctx->enforce_rules[0].config_id, ctx->enforce_para); goto error_out;
+ ctx->enforce_rules[0].config_id, ctx->enforce_para);
+ ctx->action==PG_ACTION_NONE;
+ goto error_out;
}
to_write_sess = tfe_http_session_allow_write(session);
response = tfe_http_session_response_create(to_write_sess, resp_code);
- html_generate(ctx->enforce_rules[0].config_id, resp_code, &page_buff, &page_size);
+ html_generate(resp_code, ctx->enforce_rules[0].config_id, msg, &page_buff, &page_size);
_wrap_std_field_write(response, TFE_HTTP_CONT_TYPE, "text/html; charset=utf-8");
snprintf(cont_len_str, sizeof(cont_len_str), "%lu", page_size);
_wrap_std_field_write(response, TFE_HTTP_CONT_LENGTH, cont_len_str);