aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxenoxeno <xeno@ydb.tech>2022-11-10 23:11:58 +0300
committerxenoxeno <xeno@ydb.tech>2022-11-10 23:11:58 +0300
commita2ffc87e9209ab37cff394ceef9d1d857c93a5d0 (patch)
tree4c83bd6296534ba8160d03b2402b07c64b0f06ac
parent00d3b6da5b5d5a2873ba0df994d06b82c3d0c9a7 (diff)
downloadydb-a2ffc87e9209ab37cff394ceef9d1d857c93a5d0.tar.gz
do not redirect root if we come by reference
-rw-r--r--ydb/core/mon/async_http_mon.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/ydb/core/mon/async_http_mon.cpp b/ydb/core/mon/async_http_mon.cpp
index 8d43288a55..7805201ee7 100644
--- a/ydb/core/mon/async_http_mon.cpp
+++ b/ydb/core/mon/async_http_mon.cpp
@@ -415,7 +415,14 @@ public:
}
void Handle(NHttp::TEvHttpProxy::TEvHttpIncomingRequest::TPtr& ev) {
- if (ev->Get()->Request->URL == "/" && RedirectRoot) {
+ bool redirect = false;
+ if (RedirectRoot && ev->Get()->Request->URL == "/") {
+ NHttp::THeaders headers(ev->Get()->Request->Headers);
+ if (!headers.Has("Referer")) {
+ redirect = true;
+ }
+ }
+ if (redirect) {
TStringBuilder response;
response << "HTTP/1.1 302 Found\r\nLocation: " << RedirectRoot << "\r\n\r\n";
Send(ev->Sender, new NHttp::TEvHttpProxy::TEvHttpOutgoingResponse(ev->Get()->Request->CreateResponseString(response)));