mirror of
https://github.com/gofiber/fiber.git
synced 2025-02-22 23:04:14 +00:00
commit
5dca060382
@ -3,8 +3,12 @@ package middleware
|
||||
import "github.com/gofiber/fiber"
|
||||
|
||||
// Cors : Enable cross-origin resource sharing (CORS) with various options.
|
||||
func Cors(c *fiber.Ctx, d string) {
|
||||
c.Set("Access-Control-Allow-Origin", d) // Set d to "*" for allow all domains
|
||||
func Cors(c *fiber.Ctx, origin ...string) {
|
||||
o := "*"
|
||||
if len(origin) > 0 {
|
||||
o = origin[0]
|
||||
}
|
||||
c.Set("Access-Control-Allow-Origin", o)
|
||||
c.Set("Access-Control-Allow-Headers", "X-Requested-With")
|
||||
c.Next()
|
||||
}
|
||||
|
@ -8,6 +8,6 @@ import (
|
||||
|
||||
// Helmet : Helps secure your apps by setting various HTTP headers.
|
||||
func Helmet(c *fiber.Ctx) {
|
||||
fmt.Println("Helmet is still under development, disable until v1.0.0")
|
||||
fmt.Println("Helmet is still under development, this middleware does nothing yet.")
|
||||
c.Next()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user