Added api host guard
This commit is contained in:
@@ -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()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user