@@ -314,36 +314,12 @@ class TViewer : public TActorBootstrapped<TViewer>, public IViewer {
314
314
if (type.empty ()) {
315
315
type = " application/json" ;
316
316
}
317
- if (AllowOrigin) {
318
- ctx.Send (ev->Sender , new NMon::TEvHttpInfoRes (
319
- " HTTP/1.1 204 No Content\r\n "
320
- " Access-Control-Allow-Origin: " + AllowOrigin + " \r\n "
321
- " Access-Control-Allow-Credentials: true\r\n "
322
- " Access-Control-Allow-Headers: Content-Type,Authorization,Origin,Accept\r\n "
323
- " Access-Control-Allow-Methods: OPTIONS, GET, POST\r\n "
324
- " Allow: OPTIONS, GET, POST\r\n "
325
- " Content-Type: " + type + " \r\n "
326
- " Connection: Keep-Alive\r\n\r\n " , 0 , NMon::IEvHttpInfoRes::EContentType::Custom));
327
- } else {
328
- TString origin = TString (msg->Request .GetHeader (" Origin" ));
329
- if (!origin.empty ()) {
330
- ctx.Send (ev->Sender , new NMon::TEvHttpInfoRes (
331
- " HTTP/1.1 204 No Content\r\n "
332
- " Access-Control-Allow-Origin: " + origin + " \r\n "
333
- " Access-Control-Allow-Credentials: true\r\n "
334
- " Access-Control-Allow-Headers: Content-Type,Authorization,Origin,Accept\r\n "
335
- " Access-Control-Allow-Methods: OPTIONS, GET, POST\r\n "
336
- " Allow: OPTIONS, GET, POST\r\n "
337
- " Content-Type: " + type + " \r\n "
338
- " Connection: Keep-Alive\r\n\r\n " , 0 , NMon::IEvHttpInfoRes::EContentType::Custom));
339
- } else {
340
- ctx.Send (ev->Sender , new NMon::TEvHttpInfoRes (
341
- " HTTP/1.1 204 No Content\r\n "
342
- " Allow: OPTIONS, GET, POST\r\n "
343
- " Content-Type: " + type + " \r\n "
344
- " Connection: Keep-Alive\r\n\r\n " , 0 , NMon::IEvHttpInfoRes::EContentType::Custom));
345
- }
346
- }
317
+ TStringBuilder response;
318
+ response << " HTTP/1.1 204 No Content\r\n " ;
319
+ response << GetCORS (msg);
320
+ response << " Content-Type: " + type + " \r\n "
321
+ " Connection: Keep-Alive\r\n\r\n " ;
322
+ Send (ev->Sender , new NMon::TEvHttpInfoRes (response, 0 , NMon::IEvHttpInfoRes::EContentType::Custom));
347
323
return ;
348
324
}
349
325
TString filename (msg->Request .GetPage ()->Path + msg->Request .GetPathInfo ());
@@ -444,11 +420,15 @@ TString TViewer::GetCORS(const NMon::TEvHttpInfo* request) {
444
420
} else if (request && request->Request .GetHeaders ().HasHeader (" Origin" )) {
445
421
origin = request->Request .GetHeader (" Origin" );
446
422
}
423
+ if (origin.empty ()) {
424
+ origin = " *" ;
425
+ }
447
426
if (origin) {
448
427
res << " Access-Control-Allow-Origin: " << origin << " \r\n "
449
428
<< " Access-Control-Allow-Credentials: true\r\n "
450
- << " Access-Control-Allow-Headers: Content-Type,Authorization,Origin,Accept\r\n "
451
- << " Access-Control-Allow-Methods: OPTIONS, GET, POST\r\n " ;
429
+ << " Access-Control-Allow-Headers: Content-Type,Authorization,Origin,Accept,X-Trace-Verbosity,X-Want-Trace\r\n "
430
+ << " Access-Control-Allow-Methods: OPTIONS, GET, POST, DELETE\r\n "
431
+ << " Allow: OPTIONS, GET, POST, DELETE\r\n " ;
452
432
}
453
433
return res;
454
434
}
0 commit comments