Skip to content

PostgreSQL backup tool with Point-In-Time-Recovery and restore verification

FIX (cors): Allow CORS for healthcheck endpoint

Rostislav Dugina6675390e5e5
diff --git a/backend/internal/features/system/healthcheck/controller.go b/backend/internal/features/system/healthcheck/controller.go
index 43b9edff..2913b5be 100644
--- a/backend/internal/features/system/healthcheck/controller.go
+++ b/backend/internal/features/system/healthcheck/controller.go
@@ -23,6 +23,18 @@ func (c *HealthcheckController) RegisterRoutes(router *gin.RouterGroup) {
// @Failure 503 {object} HealthcheckResponse
// @Router /system/health [get]
func (c *HealthcheckController) CheckHealth(ctx *gin.Context) {
+ // Allow unrestricted CORS for health check endpoint
+ // This enables monitoring tools from any origin to check system health
+ ctx.Header("Access-Control-Allow-Origin", "*")
+ ctx.Header("Access-Control-Allow-Methods", "GET, OPTIONS")
+ ctx.Header("Access-Control-Allow-Headers", "Content-Type")
+
+ // Handle preflight OPTIONS request
+ if ctx.Request.Method == "OPTIONS" {
+ ctx.AbortWithStatus(http.StatusNoContent)
+ return
+ }
+
err := c.healthcheckService.IsHealthy()
if err == nil {