Skip to content

Commit

Permalink
chore(middleware/cors): Update middleware/cors/cors.go
Browse files Browse the repository at this point in the history
  • Loading branch information
sixcolors authored Mar 20, 2024
1 parent 0ea8c85 commit 7293cb9
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions middleware/cors/cors.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,11 @@ func New(config ...Config) fiber.Handler {
// Preflight request
c.Vary(fiber.HeaderAccessControlRequestMethod)
c.Vary(fiber.HeaderAccessControlRequestHeaders)

setCORSHeaders(c, allowOrigin, allowMethods, allowHeaders, exposeHeaders, maxAge, cfg)

// Set Preflight request handling
if cfg.AllowPrivateNetwork && c.Get("Access-Control-Request-Private-Network") == "true" {
// Set the Access-Control-Allow-Private-Network header to "true"
if cfg.AllowPrivateNetwork && c.Get(fiber.HeaderAccessControlRequestPrivateNetwork) == "true" {

Check failure on line 221 in middleware/cors/cors.go

View workflow job for this annotation

GitHub Actions / Build (1.21.x, ubuntu-latest)

undefined: fiber.HeaderAccessControlRequestPrivateNetwork

Check failure on line 221 in middleware/cors/cors.go

View workflow job for this annotation

GitHub Actions / Build (1.21.x, ubuntu-latest)

undefined: fiber.HeaderAccessControlRequestPrivateNetwork

Check failure on line 221 in middleware/cors/cors.go

View workflow job for this annotation

GitHub Actions / Compare

undefined: fiber.HeaderAccessControlRequestPrivateNetwork

Check failure on line 221 in middleware/cors/cors.go

View workflow job for this annotation

GitHub Actions / lint

undefined: fiber.HeaderAccessControlRequestPrivateNetwork

Check failure on line 221 in middleware/cors/cors.go

View workflow job for this annotation

GitHub Actions / lint

undefined: fiber.HeaderAccessControlRequestPrivateNetwork

Check failure on line 221 in middleware/cors/cors.go

View workflow job for this annotation

GitHub Actions / lint

undefined: fiber.HeaderAccessControlRequestPrivateNetwork

Check failure on line 221 in middleware/cors/cors.go

View workflow job for this annotation

GitHub Actions / govulncheck-check

undefined: fiber.HeaderAccessControlRequestPrivateNetwork

Check failure on line 221 in middleware/cors/cors.go

View workflow job for this annotation

GitHub Actions / Build (1.21.x, macos-latest)

undefined: fiber.HeaderAccessControlRequestPrivateNetwork

Check failure on line 221 in middleware/cors/cors.go

View workflow job for this annotation

GitHub Actions / Build (1.22.x, ubuntu-latest)

undefined: fiber.HeaderAccessControlRequestPrivateNetwork

Check failure on line 221 in middleware/cors/cors.go

View workflow job for this annotation

GitHub Actions / Build (1.22.x, ubuntu-latest)

undefined: fiber.HeaderAccessControlRequestPrivateNetwork

Check failure on line 221 in middleware/cors/cors.go

View workflow job for this annotation

GitHub Actions / Build (1.22.x, macos-latest)

undefined: fiber.HeaderAccessControlRequestPrivateNetwork

Check failure on line 221 in middleware/cors/cors.go

View workflow job for this annotation

GitHub Actions / Build (1.22.x, macos-14)

undefined: fiber.HeaderAccessControlRequestPrivateNetwork
c.Vary(fiber.HeaderAccessControlRequestPrivateNetwork)

Check failure on line 222 in middleware/cors/cors.go

View workflow job for this annotation

GitHub Actions / Build (1.21.x, ubuntu-latest)

undefined: fiber.HeaderAccessControlRequestPrivateNetwork

Check failure on line 222 in middleware/cors/cors.go

View workflow job for this annotation

GitHub Actions / Build (1.21.x, ubuntu-latest)

undefined: fiber.HeaderAccessControlRequestPrivateNetwork

Check failure on line 222 in middleware/cors/cors.go

View workflow job for this annotation

GitHub Actions / Compare

undefined: fiber.HeaderAccessControlRequestPrivateNetwork

Check failure on line 222 in middleware/cors/cors.go

View workflow job for this annotation

GitHub Actions / lint

undefined: fiber.HeaderAccessControlRequestPrivateNetwork (typecheck)

Check failure on line 222 in middleware/cors/cors.go

View workflow job for this annotation

GitHub Actions / lint

undefined: fiber.HeaderAccessControlRequestPrivateNetwork (typecheck)

Check failure on line 222 in middleware/cors/cors.go

View workflow job for this annotation

GitHub Actions / lint

undefined: fiber.HeaderAccessControlRequestPrivateNetwork (typecheck)

Check failure on line 222 in middleware/cors/cors.go

View workflow job for this annotation

GitHub Actions / govulncheck-check

undefined: fiber.HeaderAccessControlRequestPrivateNetwork

Check failure on line 222 in middleware/cors/cors.go

View workflow job for this annotation

GitHub Actions / Build (1.21.x, macos-latest)

undefined: fiber.HeaderAccessControlRequestPrivateNetwork

Check failure on line 222 in middleware/cors/cors.go

View workflow job for this annotation

GitHub Actions / Build (1.22.x, ubuntu-latest)

undefined: fiber.HeaderAccessControlRequestPrivateNetwork

Check failure on line 222 in middleware/cors/cors.go

View workflow job for this annotation

GitHub Actions / Build (1.22.x, ubuntu-latest)

undefined: fiber.HeaderAccessControlRequestPrivateNetwork

Check failure on line 222 in middleware/cors/cors.go

View workflow job for this annotation

GitHub Actions / Build (1.22.x, macos-latest)

undefined: fiber.HeaderAccessControlRequestPrivateNetwork

Check failure on line 222 in middleware/cors/cors.go

View workflow job for this annotation

GitHub Actions / Build (1.22.x, macos-14)

undefined: fiber.HeaderAccessControlRequestPrivateNetwork
c.Set(fiber.HeaderAccessControlAllowPrivateNetwork, "true")
}
setCORSHeaders(c, allowOrigin, allowMethods, allowHeaders, exposeHeaders, maxAge, cfg)

// Send 204 No Content
return c.SendStatus(fiber.StatusNoContent)
Expand Down

0 comments on commit 7293cb9

Please sign in to comment.