app/vmselect: set CORS headers on /api/v1/export endpoints (#10900)

Fixes https://github.com/VictoriaMetrics/VictoriaMetrics/issues/10899
PR https://github.com/VictoriaMetrics/VictoriaMetrics/pull/10900

Co-authored-by: Max Kotliar <mkotlyar@victoriametrics.com>
This commit is contained in:
andriibeee
2026-05-07 21:03:46 +03:00
committed by GitHub
parent 0c7928b0ff
commit d5e7ecd7b1
2 changed files with 4 additions and 0 deletions

View File

@@ -262,6 +262,7 @@ func RequestHandler(w http.ResponseWriter, r *http.Request) bool {
return true
case "/api/v1/export":
exportRequests.Inc()
httpserver.EnableCORS(w, r)
if err := prometheus.ExportHandler(startTime, w, r); err != nil {
exportErrors.Inc()
httpserver.Errorf(w, r, "%s", err)
@@ -270,6 +271,7 @@ func RequestHandler(w http.ResponseWriter, r *http.Request) bool {
return true
case "/api/v1/export/csv":
exportCSVRequests.Inc()
httpserver.EnableCORS(w, r)
if err := prometheus.ExportCSVHandler(startTime, w, r); err != nil {
exportCSVErrors.Inc()
httpserver.Errorf(w, r, "%s", err)
@@ -278,6 +280,7 @@ func RequestHandler(w http.ResponseWriter, r *http.Request) bool {
return true
case "/api/v1/export/native":
exportNativeRequests.Inc()
httpserver.EnableCORS(w, r)
if err := prometheus.ExportNativeHandler(startTime, w, r); err != nil {
exportNativeErrors.Inc()
httpserver.Errorf(w, r, "%s", err)