Added api host guard

This commit is contained in:
2026-04-03 10:31:19 +02:00
parent 1aba69cfb5
commit a2e5c735a6
3 changed files with 32 additions and 6 deletions
+12
View File
@@ -0,0 +1,12 @@
package middleware
import "github.com/gofiber/fiber/v3"
func APIHostGuard(allowedHost string) fiber.Handler {
return func(c fiber.Ctx) error {
if c.Hostname() != allowedHost {
return c.Status(fiber.StatusNotFound).SendString("Not Found")
}
return c.Next()
}
}