diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc index 3ffda96a191..2a759f8ffac 100644 --- a/mgmt/RecordsConfig.cc +++ b/mgmt/RecordsConfig.cc @@ -668,7 +668,7 @@ static const RecordElement RecordsConfig[] = , {RECT_CONFIG, "proxy.config.body_factory.enable_logging", RECD_INT, "0", RECU_RESTART_TS, RR_NULL, RECC_INT, "[0-1]", RECA_NULL} , - {RECT_CONFIG, "proxy.config.body_factory.template_sets_dir", RECD_STRING, "body_factory", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[^[:space:]]+$", RECA_NULL} + {RECT_CONFIG, "proxy.config.body_factory.template_sets_dir", RECD_STRING, TS_BUILD_SYSCONFDIR "/body_factory", RECU_DYNAMIC, RR_NULL, RECC_STR, "^[^[:space:]]+$", RECA_NULL} , {RECT_CONFIG, "proxy.config.body_factory.response_max_size", RECD_INT, "8192", RECU_DYNAMIC, RR_NULL, RECC_NULL, nullptr, RECA_NULL} , diff --git a/proxy/http/HttpBodyFactory.cc b/proxy/http/HttpBodyFactory.cc index a13d06daf57..77b0c95b22d 100644 --- a/proxy/http/HttpBodyFactory.cc +++ b/proxy/http/HttpBodyFactory.cc @@ -241,6 +241,7 @@ void HttpBodyFactory::reconfigure() { RecInt e; + RecString s = nullptr; bool all_found; int rec_err; @@ -276,15 +277,22 @@ HttpBodyFactory::reconfigure() all_found = all_found && (rec_err == REC_ERR_OKAY); Debug("body_factory", "response_suppression_mode = %d (found = %" PRId64 ")", response_suppression_mode, e); - ats_scoped_str directory_of_template_sets(RecConfigReadConfigPath("proxy.config.body_factory.template_sets_dir", "body_factory")); + ats_scoped_str directory_of_template_sets; - if (access(directory_of_template_sets, R_OK) < 0) { - Warning("Unable to access() directory '%s': %d, %s", (const char *)directory_of_template_sets, errno, strerror(errno)); - Warning(" Please set 'proxy.config.body_factory.template_sets_dir' "); + rec_err = RecGetRecordString_Xmalloc("proxy.config.body_factory.template_sets_dir", &s); + all_found = all_found && (rec_err == REC_ERR_OKAY); + if (rec_err == REC_ERR_OKAY) { + directory_of_template_sets = Layout::get()->relative(s); + if (access(directory_of_template_sets, R_OK) < 0) { + Warning("Unable to access() directory '%s': %d, %s", (const char *)directory_of_template_sets, errno, strerror(errno)); + Warning(" Please set 'proxy.config.body_factory.template_sets_dir' "); + } } Debug("body_factory", "directory_of_template_sets = '%s' ", (const char *)directory_of_template_sets); + ats_free(s); + if (!all_found) { Warning("config changed, but can't fetch all proxy.config.body_factory values"); }