@@ -517,36 +517,12 @@ class TViewer : public TActorBootstrapped<TViewer>, public IViewer {
517
517
if (type.empty ()) {
518
518
type = " application/json" ;
519
519
}
520
- if (AllowOrigin) {
521
- ctx.Send (ev->Sender , new NMon::TEvHttpInfoRes (
522
- " HTTP/1.1 204 No Content\r\n "
523
- " Access-Control-Allow-Origin: " + AllowOrigin + " \r\n "
524
- " Access-Control-Allow-Credentials: true\r\n "
525
- " Access-Control-Allow-Headers: Content-Type,Authorization,Origin,Accept\r\n "
526
- " Access-Control-Allow-Methods: OPTIONS, GET, POST\r\n "
527
- " Allow: OPTIONS, GET, POST\r\n "
528
- " Content-Type: " + type + " \r\n "
529
- " Connection: Keep-Alive\r\n\r\n " , 0 , NMon::IEvHttpInfoRes::EContentType::Custom));
530
- } else {
531
- TString origin = TString (msg->Request .GetHeader (" Origin" ));
532
- if (!origin.empty ()) {
533
- ctx.Send (ev->Sender , new NMon::TEvHttpInfoRes (
534
- " HTTP/1.1 204 No Content\r\n "
535
- " Access-Control-Allow-Origin: " + origin + " \r\n "
536
- " Access-Control-Allow-Credentials: true\r\n "
537
- " Access-Control-Allow-Headers: Content-Type,Authorization,Origin,Accept\r\n "
538
- " Access-Control-Allow-Methods: OPTIONS, GET, POST\r\n "
539
- " Allow: OPTIONS, GET, POST\r\n "
540
- " Content-Type: " + type + " \r\n "
541
- " Connection: Keep-Alive\r\n\r\n " , 0 , NMon::IEvHttpInfoRes::EContentType::Custom));
542
- } else {
543
- ctx.Send (ev->Sender , new NMon::TEvHttpInfoRes (
544
- " HTTP/1.1 204 No Content\r\n "
545
- " Allow: OPTIONS, GET, POST\r\n "
546
- " Content-Type: " + type + " \r\n "
547
- " Connection: Keep-Alive\r\n\r\n " , 0 , NMon::IEvHttpInfoRes::EContentType::Custom));
548
- }
549
- }
520
+ TStringBuilder response;
521
+ response << " HTTP/1.1 204 No Content\r\n " ;
522
+ FillCORS (response, msg);
523
+ response << " Content-Type: " + type + " \r\n "
524
+ " Connection: Keep-Alive\r\n\r\n " ;
525
+ Send (ev->Sender , new NMon::TEvHttpInfoRes (response, 0 , NMon::IEvHttpInfoRes::EContentType::Custom));
550
526
return ;
551
527
}
552
528
TString path (" /" + msg->Request .GetPage ()->Path + msg->Request .GetPathInfo ());
@@ -649,11 +625,15 @@ void TViewer::FillCORS(TStringBuilder& stream, const TRequestState& request) {
649
625
} else if (request && request->Request .GetHeaders ().HasHeader (" Origin" )) {
650
626
origin = request->Request .GetHeader (" Origin" );
651
627
}
628
+ if (origin.empty ()) {
629
+ origin = " *" ;
630
+ }
652
631
if (origin) {
653
632
stream << " Access-Control-Allow-Origin: " << origin << " \r\n "
654
633
<< " Access-Control-Allow-Credentials: true\r\n "
655
- << " Access-Control-Allow-Headers: Content-Type,Authorization,Origin,Accept\r\n "
656
- << " Access-Control-Allow-Methods: OPTIONS, GET, POST\r\n " ;
634
+ << " Access-Control-Allow-Headers: Content-Type,Authorization,Origin,Accept,X-Trace-Verbosity,X-Want-Trace\r\n "
635
+ << " Access-Control-Allow-Methods: OPTIONS, GET, POST, DELETE\r\n "
636
+ << " Allow: OPTIONS, GET, POST, DELETE\r\n " ;
657
637
}
658
638
}
659
639
0 commit comments