Vary

Adds the given header field to the Vary response header. This will append the header, if not already listed, otherwise leaves it listed in the current location.

Multiple fields are allowed.
  1. func (c *Ctx) Vary(fields ...string)
  1. app.Get("/", func(c *fiber.Ctx) error {
  2. c.Vary("Origin") // => Vary: Origin
  3. c.Vary("User-Agent") // => Vary: Origin, User-Agent
  4. // No duplicates
  5. c.Vary("Origin") // => Vary: Origin, User-Agent
  6. c.Vary("Accept-Encoding", "Accept")
  7. // => Vary: Origin, User-Agent, Accept-Encoding, Accept
  8. // ...
  9. })