From 0ea2e76537915e7b5611b6a845ad394389333a08 Mon Sep 17 00:00:00 2001 From: Sudheer Vinukonda Date: Fri, 30 Apr 2021 08:58:28 -0700 Subject: [PATCH] Short circuit remap reload when non-existent remap file is specified Ensures resiliency against config errors erasing remaps previously loaded. Note that failing to load remap.config during startup will no longer fail the TS startup to allow for optionality in remap.config --- proxy/ReverseProxy.cc | 2 +- proxy/http/remap/RemapConfig.cc | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/proxy/ReverseProxy.cc b/proxy/ReverseProxy.cc index c55df4a36bc..d814f68ea30 100644 --- a/proxy/ReverseProxy.cc +++ b/proxy/ReverseProxy.cc @@ -67,7 +67,7 @@ init_reverse_proxy() Note("%s loading ...", ts::filename::REMAP); if (!rewrite_table->load()) { - Fatal("%s failed to load", ts::filename::REMAP); + Warning("%s failed to load", ts::filename::REMAP); } Note("%s finished loading", ts::filename::REMAP); diff --git a/proxy/http/remap/RemapConfig.cc b/proxy/http/remap/RemapConfig.cc index c9d06e9d4fb..3e74f2497fd 100644 --- a/proxy/http/remap/RemapConfig.cc +++ b/proxy/http/remap/RemapConfig.cc @@ -946,14 +946,8 @@ remap_parse_config_bti(const char *path, BUILD_TABLE_INFO *bti) std::error_code ec; std::string content{ts::file::load(ts::file::path{path}, ec)}; if (ec) { - switch (ec.value()) { - case ENOENT: - Warning("Can't open remapping configuration file %s - %s", path, strerror(ec.value())); - break; - default: - Error("Failed load remapping configuration file %s - %s", path, strerror(ec.value())); - return false; - } + Warning("Failed to open remapping configuration file %s - %s", path, strerror(ec.value())); + return false; } Debug("url_rewrite", "[BuildTable] UrlRewrite::BuildTable()");