diff --git a/ydb/core/viewer/viewer.cpp b/ydb/core/viewer/viewer.cpp index febcb5302632..9f7ee3984719 100644 --- a/ydb/core/viewer/viewer.cpp +++ b/ydb/core/viewer/viewer.cpp @@ -298,7 +298,6 @@ class TViewer : public TActorBootstrapped, public IViewer { bool ReplyWithFile(NMon::TEvHttpInfo::TPtr& ev, const TString& name) { if (name == "/api/viewer.yaml") { - Cerr << "CompileTime is " << GetCompileTime() << Endl; Send(ev->Sender, new NMon::TEvHttpInfoRes(GetHTTPOKYAML(ev->Get(), Dump(GetSwaggerYaml()), GetCompileTime()), 0, NMon::IEvHttpInfoRes::EContentType::Custom)); return true; } @@ -322,6 +321,9 @@ class TViewer : public TActorBootstrapped, public IViewer { type = mimetypeByExt(filename.c_str()); } else { filename = name; + if (filename.StartsWith("/")) { + filename.erase(0, 1); + } if (NResource::FindExact(filename, &blob)) { type = mimetypeByExt(filename.c_str()); } @@ -420,31 +422,27 @@ class TViewer : public TActorBootstrapped, public IViewer { return; } } - if (path.StartsWith("counters/hosts")) { + if (path.StartsWith("/counters/hosts")) { ctx.ExecutorThread.RegisterActor(new TCountersHostsList(this, ev)); return; } - if (path.StartsWith("healthcheck")) { - ctx.ExecutorThread.RegisterActor(new TJsonHealthCheck(this, ev)); - return; - } // TODO: check path validity // TODO: cache if (msg->Request.GetPathInfo().StartsWith('/')) { if (path.StartsWith("/viewer")) { path.erase(0, 7); } - if (IsMatchesWildcard(path, "monitoring*/static/js/*") - || IsMatchesWildcard(path, "monitoring*/static/css/*") - || IsMatchesWildcard(path, "monitoring*/static/media/*") - || IsMatchesWildcard(path, "monitoring*/static/assets/fonts/*") - || IsMatchesWildcard(path, "monitoring*/static/favicon.png")) { + if (IsMatchesWildcard(path, "/monitoring*/static/js/*") + || IsMatchesWildcard(path, "/monitoring*/static/css/*") + || IsMatchesWildcard(path, "/monitoring*/static/media/*") + || IsMatchesWildcard(path, "/monitoring*/static/assets/fonts/*") + || IsMatchesWildcard(path, "/monitoring*/static/favicon.png")) { auto resPos = path.find("/static/"); if (resPos != TString::npos) { - path = "monitoring" + path.substr(resPos); + path = "/monitoring" + path.substr(resPos); } - } else if (path.StartsWith("monitoring") && path != "monitoring/index.html") { - path = "monitoring/index.html"; + } else if (path.StartsWith("/monitoring") && path != "/monitoring/index.html") { + path = "/monitoring/index.html"; } if (path.EndsWith('/')) { path += "index.html";