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. c.Vary(field ...string)
  1. app.Get("/", func(c *fiber.Ctx) {
  2. c.Vary("Origin") // => Vary: Origin
  3. c.Vary("User-Agent") // => Vary: Origin, User-Agent
  4.  
  5. // No duplicates
  6. c.Vary("Origin") // => Vary: Origin, User-Agent
  7.  
  8. c.Vary("Accept-Encoding", "Accept")
  9. // => Vary: Origin, User-Agent, Accept-Encoding, Accept
  10. })