aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandrew-rykov <arykov@ydb.tech>2023-04-18 12:30:37 +0300
committerandrew-rykov <arykov@ydb.tech>2023-04-18 12:30:37 +0300
commit4dcb651d85a03d0f29eb5d15305efbb0f736a72b (patch)
tree34e043a78111def21b6bcf4f66a9d9ae3863b5d7
parent60dfccec1ff3f4899325bc2bee6696358a444bfa (diff)
downloadydb-4dcb651d85a03d0f29eb5d15305efbb0f736a72b.tar.gz
CORS reply tablet
-rw-r--r--ydb/core/mon/mon_impl.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/ydb/core/mon/mon_impl.h b/ydb/core/mon/mon_impl.h
index ab56828c764..dc54b7c35ff 100644
--- a/ydb/core/mon/mon_impl.h
+++ b/ydb/core/mon/mon_impl.h
@@ -245,7 +245,18 @@ public:
void Output(NMonitoring::IMonHttpRequest& request) override {
IOutputStream& out = request.Output();
- out << HTTPOKHTML;
+ out << "HTTP/1.1 200 Ok\r\n"
+ << "Content-Type: text/html\r\n"
+ << "Connection: Close\r\n";
+ TString origin = TString(request.GetHeader("Origin"));
+ if (origin.empty()) {
+ origin = "*";
+ }
+ out << "Access-Control-Allow-Origin: " << origin << "\r\n"
+ << "Access-Control-Allow-Credentials: true\r\n"
+ << "Access-Control-Allow-Headers: Content-Type,Authorization,Origin,Accept\r\n"
+ << "Access-Control-Allow-Methods: OPTIONS, GET, POST\r\n";
+ out << "\r\n";
out << "<!DOCTYPE html>\n";
out << "<html>";