gofiber/fiber (github.com/gofiber/fiber/v2)
### [`v2.52.1`](https://togithub.com/gofiber/fiber/releases/tag/v2.52.1)
[Compare Source](https://togithub.com/gofiber/fiber/compare/v2.52.0...v2.52.1)
#### ๐ฎ Security
Middleware/cors: Insecure CORS Configuration Allowing Wildcard Origin with Credentials -
GHSA-fmg4-x8pw-hjhg
https://docs.gofiber.io/api/middleware/cors
#### ๐ Fixes
- Middleware/healthcheck: Not working with route group([#2863](https://togithub.com/gofiber/fiber/issues/2863))
#### ๐ Documentation
- Fix default value to false in docs of QueryBool ([#2811](https://togithub.com/gofiber/fiber/issues/2811))
- Fix code snippet indentation in /docs/api/middleware/keyauth.md ([#2867](https://togithub.com/gofiber/fiber/issues/2867))
**Full Changelog**: https://github.com/gofiber/fiber/compare/v2.52.0...v2.52.1
Thank you [@luk3skyw4lker](https://togithub.com/luk3skyw4lker), [@CAEL0](https://togithub.com/CAEL0), [@grivera64](https://togithub.com/grivera64), [@gaby](https://togithub.com/gaby) and [@sixcolors](https://togithub.com/sixcolors) for making this update possible.
### [`v2.52.0`](https://togithub.com/gofiber/fiber/releases/tag/v2.52.0)
[Compare Source](https://togithub.com/gofiber/fiber/compare/v2.51.0...v2.52.0)
#### ๐ New
- Middleware/healthcheck: Add liveness and readiness checks ([#2509](https://togithub.com/gofiber/fiber/issues/2509))
https://docs.gofiber.io/api/middleware/healthcheck
```go
// Direct usage with default config
app.Use(healthcheck.New())
// Or extend your config for customization
app.Use(healthcheck.New(healthcheck.Config{
LivenessEndpoint: "/live",
LivenessProbe: func(c *fiber.Ctx) bool {
return true
},
ReadinessEndpoint: "/ready",
ReadinessProbe: func(c *fiber.Ctx) bool {
return serviceA.Ready() && serviceB.Ready() && ...
},
}))
```
#### ๐งน Updates
- Middlewares: don't constrain middlewares context-keys to strings ([#2751](https://togithub.com/gofiber/fiber/issues/2751))
- Middleware/logger: colorize logger error message [#2593](https://togithub.com/gofiber/fiber/issues/2593) ([#2773](https://togithub.com/gofiber/fiber/issues/2773))
- Middleware/logger: changing default log output ([#2730](https://togithub.com/gofiber/fiber/issues/2730))
- Middleware/logger: log client IP address by default ([#2755](https://togithub.com/gofiber/fiber/issues/2755))
- Middleware/encryptcookie: update default config ([#2753](https://togithub.com/gofiber/fiber/issues/2753))
- Improve benchmarks for getOffer ([#2739](https://togithub.com/gofiber/fiber/issues/2739))
#### ๐ ๏ธ Maintenance
- Bump github/codeql-action from 2 to 3 ([#2763](https://togithub.com/gofiber/fiber/issues/2763))
- Bump github.com/google/uuid from 1.4.0 to 1.5.0 ([#2762](https://togithub.com/gofiber/fiber/issues/2762))
- Bump actions/setup-go from 4 to 5 ([#2754](https://togithub.com/gofiber/fiber/issues/2754))
- Bump golang.org/x/sys from 0.14.0 to 0.15.0 ([#2744](https://togithub.com/gofiber/fiber/issues/2744))
- Bump github.com/valyala/fasthttp from 1.50.0 to 1.51.0 ([#2721](https://togithub.com/gofiber/fiber/issues/2721))
#### ๐ Fixes
- Middleware/redirect : fix for redirect with query params ([#2748](https://togithub.com/gofiber/fiber/issues/2748))
- Middleware/adaptor: Adaptor + otelfiber issue [#2641](https://togithub.com/gofiber/fiber/issues/2641) ([#2772](https://togithub.com/gofiber/fiber/issues/2772))
- Middleware/cors: Should use the defined AllowedOriginsFunc config when AllowedOrigins is empty ([#2771](https://togithub.com/gofiber/fiber/issues/2771))
- Middleware/session: Race in session middleware tests ([#2740](https://togithub.com/gofiber/fiber/issues/2740))
- Middleware/csrf: Fix failing CSRF tests ([#2720](https://togithub.com/gofiber/fiber/issues/2720))
- Fix race condition in parallel tests ([#2734](https://togithub.com/gofiber/fiber/issues/2734))
- utils.IsIPv4 and net.ParseIP have inconsistent results [#2735](https://togithub.com/gofiber/fiber/issues/2735) ([#2736](https://togithub.com/gofiber/fiber/issues/2736))
#### ๐ Documentation
- Middleware/csrf: Improve csrf docs ([#2726](https://togithub.com/gofiber/fiber/issues/2726))
- Update app.md for indentation ([#2761](https://togithub.com/gofiber/fiber/issues/2761))
- Update default config ([#2753](https://togithub.com/gofiber/fiber/issues/2753))
- Update CONTRIBUTING.md ([#2752](https://togithub.com/gofiber/fiber/issues/2752))
**Full Changelog**: https://github.com/gofiber/fiber/compare/v2.51.0...v2.52.0
Thank you [@MehmetFiratKomurcu](https://togithub.com/MehmetFiratKomurcu), [@benjajaja](https://togithub.com/benjajaja), [@brunodmartins](https://togithub.com/brunodmartins), [@gilwo](https://togithub.com/gilwo), [@iredmail](https://togithub.com/iredmail), [@itswcg](https://togithub.com/itswcg), [@luk3skyw4lker](https://togithub.com/luk3skyw4lker), [@muhammadkholidb](https://togithub.com/muhammadkholidb), [@nickajacks1](https://togithub.com/nickajacks1), [@sixcolors](https://togithub.com/sixcolors) and [@tokelo-12](https://togithub.com/tokelo-12) for making this update possible.
### [`v2.51.0`](https://togithub.com/gofiber/fiber/releases/tag/v2.51.0)
[Compare Source](https://togithub.com/gofiber/fiber/compare/v2.50.0...v2.51.0)
#### ๐ New
- Add support for parameters in content negotiation ([#2678](https://togithub.com/gofiber/fiber/issues/2678)) [RFC](https://www.rfc-editor.org/rfc/rfc9110#name-parameters)
https://docs.gofiber.io/api/ctx#accepts
```go
// Consideration of parameters in the accepted headers
// Accept: text/plain, application/json; version=1; foo=bar
app.Get("/", func(c *fiber.Ctx) error {
// Extra parameters in the accept are ignored
c.Accepts("text/plain;format=flowed") // "text/plain;format=flowed"
// An offer must contain all parameters present in the Accept type
c.Accepts("application/json") // ""
// Parameter order and capitalization does not matter. Quotes on values are stripped.
c.Accepts(`application/json;foo="bar";VERSION=1`) // "application/json;foo="bar";VERSION=1"
})
```
- Add support for application/problem+json ([#2704](https://togithub.com/gofiber/fiber/issues/2704))
https://docs.gofiber.io/api/ctx#json
https://docs.gofiber.io/api/client#json
```go
// Passing a custom json type
ctx.JSON(fiber.Map{
"type": "https://example.com/probs/out-of-credit",
"title": "You do not have enough credit.",
"status": 403,
"detail": "Your current balance is 30, but that costs 50.",
"instance": "/account/12345/msgs/abc",
}, fiber.)
```
#### ๐งน Updates
- Ctx.Range: reduce allocations ([#2705](https://togithub.com/gofiber/fiber/issues/2705))
- Middleware/pprof: improve performance ([#2709](https://togithub.com/gofiber/fiber/issues/2709))
#### ๐ ๏ธ Maintenance
- Bump golang.org/x/sys from 0.13.0 to 0.14.0 ([#2707](https://togithub.com/gofiber/fiber/issues/2707))
- Bump github.com/google/uuid from 1.3.1 to 1.4.0 ([#2693](https://togithub.com/gofiber/fiber/issues/2693))
- Bump actions/setup-node from 3 to 4 ([#2690](https://togithub.com/gofiber/fiber/issues/2690))
- Bump github.com/mattn/go-isatty from 0.0.19 to 0.0.20 ([#2679](https://togithub.com/gofiber/fiber/issues/2679))
#### ๐ Fixes
- Middleware/limiter: fix intermittent failures ([#2716](https://togithub.com/gofiber/fiber/issues/2716))
- Naming of routes works wrong after mount [#2688](https://togithub.com/gofiber/fiber/issues/2688) ([#2689](https://togithub.com/gofiber/fiber/issues/2689))
- Fix method validation on route naming ([#2686](https://togithub.com/gofiber/fiber/issues/2686))
#### ๐ Documentation
- Changed "Twitter" to "X (Twitter)" in README.md Contribute Section ([#2696](https://togithub.com/gofiber/fiber/issues/2696))
- Add additional information as to why GetReqHeaders returns a map where the values are slices of strings ([#2698](https://togithub.com/gofiber/fiber/issues/2698))
- Enhance csrf.md ([#2692](https://togithub.com/gofiber/fiber/issues/2692))
**Full Changelog**: https://github.com/gofiber/fiber/compare/v2.50.0...v2.51.0
Thank you [@BandhiyaHardik](https://togithub.com/BandhiyaHardik), [@database64128](https://togithub.com/database64128), [@efectn](https://togithub.com/efectn), [@moritz157](https://togithub.com/moritz157), [@nickajacks1](https://togithub.com/nickajacks1), [@rhburt](https://togithub.com/rhburt) and [@sixcolors](https://togithub.com/sixcolors) for making this update possible.
### [`v2.50.0`](https://togithub.com/gofiber/fiber/releases/tag/v2.50.0)
[Compare Source](https://togithub.com/gofiber/fiber/compare/v2.49.2...v2.50.0)
#### โ Breaking Changes
- Change signatures of GetReqHeaders and GetRespHeaders ([#2650](https://togithub.com/gofiber/fiber/issues/2650))
> To allow single and list values under headers according to the [rfc standard](https://datatracker.ietf.org/doc/html/rfc9110#section-5.2)
```diff
- func (c *Ctx) GetReqHeaders() map[string]string
+ func (c *Ctx) GetReqHeaders() map[string][]string
```
```diff
- func (c *Ctx) GetRespHeaders() map[string]string
+ func (c *Ctx) GetRespHeaders() map[string][]string
```
#### ๐ฎ Security
Middleware/csrf: Token Vulnerability (GHSA-mv73-f69x-444p, GHSA-94w9-97p3-p368)
https://docs.gofiber.io/api/middleware/csrf
๐ Improvements to the CSRF middleware:
- Added support for single-use tokens through the `SingleUseToken` configuration option.
- Optional integration with GoFiber session middleware through the `Session` and `SessionKey` configuration options.
- Introduction of origin checks for HTTPS connections to verify referer headers.
- Implementation of a Double Submit Cookie approach for CSRF token generation and validation when used without `Session`.
- Enhancement of error handling with more descriptive error messages.
- The documentation for the CSRF middleware has been enhanced with the addition of the new options and best practices to improve security.
Thank you [@sixcolors](https://togithub.com/sixcolors)
#### ๐ New
- Cookie parser ([#2656](https://togithub.com/gofiber/fiber/issues/2656))
https://docs.gofiber.io/api/ctx#cookieparser
```go
// Field names should start with an uppercase letter
type Person struct {
Name string `cookie:"name"`
Age int `cookie:"age"`
Job bool `cookie:"job"`
}
// Example route
app.Get("/", func(c *fiber.Ctx) error {
p := new(Person)
// This method is similar to BodyParser, but for cookie parameters
if err := c.CookieParser(p); err != nil {
return err
}
log.Println(p.Name) // Joseph
log.Println(p.Age) // 23
log.Println(p.Job) // true
})
```
- Middleware/cors: Allow disabling caching in preflight requests ([#2649](https://togithub.com/gofiber/fiber/issues/2649))
https://docs.gofiber.io/api/middleware/cors#config
```go
// To disable caching completely, pass MaxAge value negative. It will set the Access-Control-Max-Age header 0.
app.Use(cors.New(cors.Config{MaxAge: -1}))
```
- Middleware/session: Add Reset method to Session struct in session middleware ([#2654](https://togithub.com/gofiber/fiber/issues/2654))
https://docs.gofiber.io/api/middleware/session#signatures
```go
// Provide more flexibility in session management, especially in scenarios like repeated user logins
func (s *Session) Reset() error
```
Example usage:
```go
// Initialize default config
// This stores all of your app's sessions
store := session.New()
app.Post("/login", func(c *fiber.Ctx) error {
// Get session from storage
sess, err := store.Get(c)
if err != nil {
panic(err)
}
// ... validate login ...
// Check if the session is fresh
if !sess.Fresh() {
// If the session is not fresh, reset it
if err := sess.Reset(); err != nil {
panic(err)
}
}
// Set new session data
sess.Set("user_id", user.ID)
// Save session
if err := sess.Save(); err != nil {
panic(err)
}
return c.SendString(fmt.Sprintf("Welcome %v", user.ID))
})
```
- Middleware/session: Add Delete method to Store struct in session middleware ([#2655](https://togithub.com/gofiber/fiber/issues/2655))
https://docs.gofiber.io/api/middleware/session#signatures
```go
// Provide more control over individual session management, especially in scenarios
// like administrator-enforced user logout or user-initiated logout from a specific device session
func (s *Store) Delete(id string) error
```
Example usage:
```go
app.Post("/admin/session/:id/logout", func(c *fiber.Ctx) error {
// Get session id from request
sessionID := c.Params("id")
// Delete the session
if err := store.Delete(sessionID); err != nil {
return c.Status(500).SendString(err.Error())
}
return c.SendString("Logout successful")
})
```
#### ๐งน Updates
- Middleware/filesystem: Improve status for SendFile ([#2664](https://togithub.com/gofiber/fiber/issues/2664))
- Middleware/filesystem: Set response code ([#2632](https://togithub.com/gofiber/fiber/issues/2632))
- Refactor Ctx.Method func to improve code readability ([#2647](https://togithub.com/gofiber/fiber/issues/2647))
#### ๐ ๏ธ Maintenance
- Fix loop variable captured by func literal ([#2660](https://togithub.com/gofiber/fiber/issues/2660))
- Run gofumpt and goimports ([#2662](https://togithub.com/gofiber/fiber/issues/2662))
- Use utils.AssertEqual instead of t.Fatal on some tests ([#2653](https://togithub.com/gofiber/fiber/issues/2653))
- Apply go fix ./... with latest version of go in repository ([#2661](https://togithub.com/gofiber/fiber/issues/2661))
- Bump github.com/valyala/fasthttp from 1.49.0 to 1.50.0 ([#2634](https://togithub.com/gofiber/fiber/issues/2634))
- Bump golang.org/x/sys from 0.12.0 to 0.13.0 ([#2665](https://togithub.com/gofiber/fiber/issues/2665))
#### ๐ Fixes
- Path checking on route naming ([#2676](https://togithub.com/gofiber/fiber/issues/2676))
- Incorrect log depth when use log.WithContext ([#2666](https://togithub.com/gofiber/fiber/issues/2666))
- Jsonp ignoring custom json encoder ([#2658](https://togithub.com/gofiber/fiber/issues/2658))
- PassLocalsToView when bind parameter is nil ([#2651](https://togithub.com/gofiber/fiber/issues/2651))
- Parse ips return invalid in abnormal case ([#2642](https://togithub.com/gofiber/fiber/issues/2642))
- Bug parse custom header ([#2638](https://togithub.com/gofiber/fiber/issues/2638))
- Middleware/adaptor: Reduce memory usage by replacing io.ReadAll() with io.Copy() ([#2637](https://togithub.com/gofiber/fiber/issues/2637))
- Middleware/idempotency: Nil pointer dereference issue on idempotency middleware ([#2668](https://togithub.com/gofiber/fiber/issues/2668))
#### ๐ Documentation
- Incorrect status code source ([#2667](https://togithub.com/gofiber/fiber/issues/2667))
- Middleware/requestid: Typo in requestid.md ([#2675](https://togithub.com/gofiber/fiber/issues/2675))
- Middleware/cors: Update docs to better explain AllowOriginsFunc ([#2652](https://togithub.com/gofiber/fiber/issues/2652))
**Full Changelog**: https://github.com/gofiber/fiber/compare/v2.49.2...v2.50.0
Thank you [@KaptinLin](https://togithub.com/KaptinLin), [@Skyenought](https://togithub.com/Skyenought), [@cuipeiyu](https://togithub.com/cuipeiyu), [@dairlair](https://togithub.com/dairlair), [@efectn](https://togithub.com/efectn), [@gaby](https://togithub.com/gaby), [@geerew](https://togithub.com/geerew), [@huykn](https://togithub.com/huykn), [@jimmyl02](https://togithub.com/jimmyl02), [@joey1123455](https://togithub.com/joey1123455), [@joshlarsen](https://togithub.com/joshlarsen), [@jscappini](https://togithub.com/jscappini), [@peczenyj](https://togithub.com/peczenyj) and [@sixcolors](https://togithub.com/sixcolors) for making this update possible.
### [`v2.49.2`](https://togithub.com/gofiber/fiber/releases/tag/v2.49.2)
[Compare Source](https://togithub.com/gofiber/fiber/compare/v2.49.1...v2.49.2)
#### ๐งน Updates
- Middleware/logger: Enabling color changes padding for some fields [#2604](https://togithub.com/gofiber/fiber/issues/2604) ([#2616](https://togithub.com/gofiber/fiber/issues/2616))
- Bump actions/checkout from 3 to 4 ([#2618](https://togithub.com/gofiber/fiber/issues/2618))
- Bump golang.org/x/sys from 0.11.0 to 0.12.0 ([#2617](https://togithub.com/gofiber/fiber/issues/2617))
#### ๐ Fixes
- Vulnerability in Ctx.IsFromLocal(https://github.com/gofiber/fiber/security/advisories/GHSA-3q5p-3558-364f)
#### ๐ Documentation
- Replaced double quotes with backticks in all route parameter strings ([#2591](https://togithub.com/gofiber/fiber/issues/2591))
**Full Changelog**: https://github.com/gofiber/fiber/compare/v2.49.1...v2.49.2
Thank you [@11-aryan](https://togithub.com/11-aryan) and [@AKARSHITJOSHI](https://togithub.com/AKARSHITJOSHI) for making this update possible.
### [`v2.49.1`](https://togithub.com/gofiber/fiber/releases/tag/v2.49.1)
[Compare Source](https://togithub.com/gofiber/fiber/compare/v2.49.0...v2.49.1)
#### ๐งน Updates
- Bump github.com/valyala/fasthttp from 1.48.0 to 1.49.0 ([#2615](https://togithub.com/gofiber/fiber/issues/2615))
#### ๐ Fixes
- Rollback changes to go.mod file ([#2614](https://togithub.com/gofiber/fiber/issues/2614))
#### ๐ Documentation
- Add Polish translation - README_pl.md ([#2613](https://togithub.com/gofiber/fiber/issues/2613))
- Update README_ko.md ([#2605](https://togithub.com/gofiber/fiber/issues/2605))
**Full Changelog**: https://github.com/gofiber/fiber/compare/v2.49.0...v2.49.1
Thank you [@KompocikDot](https://togithub.com/KompocikDot), [@LimJiAn](https://togithub.com/LimJiAn) and [@gaby](https://togithub.com/gaby) for making this update possible.
### [`v2.49.0`](https://togithub.com/gofiber/fiber/releases/tag/v2.49.0)
[Compare Source](https://togithub.com/gofiber/fiber/compare/v2.48.0...v2.49.0)
#### โ Breaking Changes
- Add config to enable splitting by comma in parsers ([#2560](https://togithub.com/gofiber/fiber/issues/2560))
https://docs.gofiber.io/api/fiber#config
> EnableSplittingOnParsers splits the query/body/header parameters by comma when it's true (default: false).
>
> For example, you can use it to parse multiple values from a query parameter like this:
> /api?foo=bar,baz == foo\[]=bar\&foo\[]=baz
#### ๐ New
- Add custom data property to favicon middleware config ([#2579](https://togithub.com/gofiber/fiber/issues/2579))
https://docs.gofiber.io/api/middleware/favicon#config
> This allows the user to use //go:embed flags to load favicon data during build-time, and supply it to the middleware instead of reading the file every time the application starts.
#### ๐งน Updates
- Middleware/logger: Latency match gin-gonic/gin formatter ([#2569](https://togithub.com/gofiber/fiber/issues/2569))
- Middleware/filesystem: Refactor: use `errors.Is` instead of `os.IsNotExist` ([#2558](https://togithub.com/gofiber/fiber/issues/2558))
- Use Global vars instead of local vars for isLocalHost ([#2595](https://togithub.com/gofiber/fiber/issues/2595))
- Remove redundant nil check ([#2584](https://togithub.com/gofiber/fiber/issues/2584))
- Bump github.com/mattn/go-runewidth from 0.0.14 to 0.0.15 ([#2551](https://togithub.com/gofiber/fiber/issues/2551))
- Bump github.com/google/uuid from 1.3.0 to 1.3.1 ([#2592](https://togithub.com/gofiber/fiber/issues/2592))
- Bump golang.org/x/sys from 0.10.0 to 0.11.0 ([#2563](https://togithub.com/gofiber/fiber/issues/2563))
- Add go 1.21 to ci and readmes ([#2588](https://togithub.com/gofiber/fiber/issues/2588))
#### ๐ Fixes
- Middleware/logger: Default latency output format ([#2580](https://togithub.com/gofiber/fiber/issues/2580))
- Decompress request body when multi Content-Encoding sent on request headers ([#2555](https://togithub.com/gofiber/fiber/issues/2555))
#### ๐ Documentation
- Fix wrong JSON docs ([#2554](https://togithub.com/gofiber/fiber/issues/2554))
- Update io/ioutil package to io package ([#2589](https://togithub.com/gofiber/fiber/issues/2589))
- Replace EG flag with the proper and smaller SVG ([#2585](https://togithub.com/gofiber/fiber/issues/2585))
- Added Egyptian Arabic readme file ([#2565](https://togithub.com/gofiber/fiber/issues/2565))
- Translate README to Portuguese ([#2567](https://togithub.com/gofiber/fiber/issues/2567))
- Improve \*fiber.Client section ([#2553](https://togithub.com/gofiber/fiber/issues/2553))
- Improved the config section of the middleware readmeยดs ([#2552](https://togithub.com/gofiber/fiber/issues/2552))
- Added documentation about ctx Fresh ([#2549](https://togithub.com/gofiber/fiber/issues/2549))
- Update intro.md ([#2550](https://togithub.com/gofiber/fiber/issues/2550))
- Fixed link to slim template engine ([#2547](https://togithub.com/gofiber/fiber/issues/2547))
**Full Changelog**: https://github.com/gofiber/fiber/compare/v2.48.0...v2.49.0
Thank you [@Jictyvoo](https://togithub.com/Jictyvoo), [@Juneezee](https://togithub.com/Juneezee), [@Kirari04](https://togithub.com/Kirari04), [@LimJiAn](https://togithub.com/LimJiAn), [@PassTheMayo](https://togithub.com/PassTheMayo), [@andersonmiranda-com](https://togithub.com/andersonmiranda-com), [@bigpreshy](https://togithub.com/bigpreshy), [@efectn](https://togithub.com/efectn), [@renanbastos93](https://togithub.com/renanbastos93), [@scandar](https://togithub.com/scandar), [@sixcolors](https://togithub.com/sixcolors) and [@stefanb](https://togithub.com/stefanb) for making this update possible.
### [`v2.48.0`](https://togithub.com/gofiber/fiber/releases/tag/v2.48.0)
[Compare Source](https://togithub.com/gofiber/fiber/compare/v2.47.0...v2.48.0)
#### ๐ New
- Add ability to print custom message on startup ([#2491](https://togithub.com/gofiber/fiber/issues/2491))
https://docs.gofiber.io/guide/hooks#onlisten
```go
app := fiber.New(fiber.Config{
DisableStartupMessage: true,
})
app.Hooks().OnListen(func(listenData fiber.ListenData) error {
if fiber.IsChild() {
return nil
}
scheme := "http"
if data.TLS {
scheme = "https"
}
log.Println(scheme + "://" + listenData.Host + ":" + listenData.Port)
return nil
})
app.Listen(":5000")
```
- Add Logger interface and fiberlog ([#2499](https://togithub.com/gofiber/fiber/issues/2499))
https://docs.gofiber.io/api/log
#### ๐งน Updates
- Dictpool is not completely gone ([#2540](https://togithub.com/gofiber/fiber/issues/2540))
- Bump golang.org/x/sys from 0.9.0 to 0.10.0 ([#2530](https://togithub.com/gofiber/fiber/issues/2530))
- Bump github.com/valyala/fasthttp from 1.47.0 to 1.48.0 ([#2511](https://togithub.com/gofiber/fiber/issues/2511))
#### ๐ Fixes
- Middleware/logger: Default logger color behaviour ([#2513](https://togithub.com/gofiber/fiber/issues/2513))
#### ๐ Documentation
- Fix link ([#2542](https://togithub.com/gofiber/fiber/issues/2542))
- Fix bad documentation on queries function ([#2522](https://togithub.com/gofiber/fiber/issues/2522))
- Fix validation-guide ([#2517](https://togithub.com/gofiber/fiber/issues/2517))
- Fix bad documentation on queries function ([#2522](https://togithub.com/gofiber/fiber/issues/2522))
- Add a warning on security implications when using X-Forwarded-For improperly ([#2520](https://togithub.com/gofiber/fiber/issues/2520))
- Fix typo ([#2518](https://togithub.com/gofiber/fiber/issues/2518))
- Typo in ctx.md ([#2516](https://togithub.com/gofiber/fiber/issues/2516))
- Fix comment in client.go ([#2514](https://togithub.com/gofiber/fiber/issues/2514))
- Fix docs api fiber custom config ([#2510](https://togithub.com/gofiber/fiber/issues/2510))
**Full Changelog**: https://github.com/gofiber/fiber/compare/v2.47.0...v2.48.0
Thank you [@ForAeons](https://togithub.com/ForAeons), [@RHeynsZa](https://togithub.com/RHeynsZa), [@Saman-Safaei](https://togithub.com/Saman-Safaei), [@Skyenought](https://togithub.com/Skyenought), [@Z3NTL3](https://togithub.com/Z3NTL3), [@andre-dasilva](https://togithub.com/andre-dasilva), [@cmd777](https://togithub.com/cmd777), [@dozheiny](https://togithub.com/dozheiny), [@efectn](https://togithub.com/efectn), [@f1rstmehul](https://togithub.com/f1rstmehul), [@gaby](https://togithub.com/gaby), [@itcuihao](https://togithub.com/itcuihao) and [@mo1ein](https://togithub.com/mo1ein) for making this update possible.
### [`v2.47.0`](https://togithub.com/gofiber/fiber/releases/tag/v2.47.0)
[Compare Source](https://togithub.com/gofiber/fiber/compare/v2.46.0...v2.47.0)
#### ๐ New
- Add queries function ([#2475](https://togithub.com/gofiber/fiber/issues/2475))
https://docs.gofiber.io/api/ctx#queries
```go
// GET /api/posts?filters.author.name=John&filters.category.name=Technology
app.Get("/", func(c *fiber.Ctx) error {
m := c.Queries()
m["filters.author.name"] // John
m["filters.category.name"] // Technology
})
```
- Middleware/logger: Add DisableColors to set the default output format ([#2493](https://togithub.com/gofiber/fiber/issues/2493))
https://docs.gofiber.io/api/middleware/logger#config
```go
// Disable colors when outputting to default format
app.Use(logger.New(logger.Config{
DisableColors: true,
}))
```
#### ๐งน Updates
- Update getOffer to consider quality and specificity ([#2486](https://togithub.com/gofiber/fiber/issues/2486))
- Use c.app.getString instead of string(...) ([#2489](https://togithub.com/gofiber/fiber/issues/2489))
- Bump github.com/mattn/go-isatty from 0.0.18 to 0.0.19 ([#2474](https://togithub.com/gofiber/fiber/issues/2474))
- Bump golang.org/x/sys from 0.8.0 to 0.9.0 ([#2508](https://togithub.com/gofiber/fiber/issues/2508))
#### ๐ Fixes
- Middleware/limiter: Fix Sliding Window limiter when SkipSuccessfulRequests/SkipFailedRequests is used. ([#2484](https://togithub.com/gofiber/fiber/issues/2484))
- Fix onListen hooks when they are used with prefork mode ([#2504](https://togithub.com/gofiber/fiber/issues/2504))
- Fix middleware naming and returned values of group methods ([#2477](https://togithub.com/gofiber/fiber/issues/2477))
- Treat case for possible timer memory leak ([#2488](https://togithub.com/gofiber/fiber/issues/2488))
- Reset terminal colors after print routes ([#2481](https://togithub.com/gofiber/fiber/issues/2481))
#### ๐ Documentation
- Update version of html template ([#2505](https://togithub.com/gofiber/fiber/issues/2505))
- Translate README_fa.md ([#2496](https://togithub.com/gofiber/fiber/issues/2496))
- Correcting a syntax error in the README ([#2473](https://togithub.com/gofiber/fiber/issues/2473))
**Full Changelog**: https://github.com/gofiber/fiber/compare/v2.46.0...v2.47.0
Thank you [@Kamandlou](https://togithub.com/Kamandlou), [@Satont](https://togithub.com/Satont), [@Skyenought](https://togithub.com/Skyenought), [@cmd777](https://togithub.com/cmd777), [@dozheiny](https://togithub.com/dozheiny), [@efectn](https://togithub.com/efectn), [@gaby](https://togithub.com/gaby), [@kaazedev](https://togithub.com/kaazedev), [@luk3skyw4lker](https://togithub.com/luk3skyw4lker), [@obakumen](https://togithub.com/obakumen), [@sixcolors](https://togithub.com/sixcolors) and [@ytsruh](https://togithub.com/ytsruh) for making this update possible.
### [`v2.46.0`](https://togithub.com/gofiber/fiber/releases/tag/v2.46.0)
[Compare Source](https://togithub.com/gofiber/fiber/compare/v2.45.0...v2.46.0)
#### ๐ New
- Utils: add Go 1.20+ way of converting byte slice to string ([#2468](https://togithub.com/gofiber/fiber/issues/2468))
- Middleware/adaptor: allow to convert fiber.Ctx to (net/http).Request ([#2461](https://togithub.com/gofiber/fiber/issues/2461))
#### ๐งน Updates
- Speedup and cleanup "path" testcases and benchmarks ([#2465](https://togithub.com/gofiber/fiber/issues/2465))
- Middleware/adaptor: allow to convert fiber.Ctx to (net/http).Request ([#2461](https://togithub.com/gofiber/fiber/issues/2461))
- Utils: add Go 1.20+ way of converting string to byte slice ([#2462](https://togithub.com/gofiber/fiber/issues/2462))
- Merge some external middlewares to core ([#2453](https://togithub.com/gofiber/fiber/issues/2453))
https://docs.gofiber.io/category/-middleware
#### ๐ Fixes
- Fix mount route positioning ([#2463](https://togithub.com/gofiber/fiber/issues/2463))
#### ๐ Documentation
- Update README_ru.md ([#2456](https://togithub.com/gofiber/fiber/issues/2456))
**Full Changelog**: https://github.com/gofiber/fiber/compare/v2.45.0...v2.46.0
Thank you [@alekseikovrigin](https://togithub.com/alekseikovrigin), [@efectn](https://togithub.com/efectn) and [@leonklingele](https://togithub.com/leonklingele) for making this update possible.
### [`v2.45.0`](https://togithub.com/gofiber/fiber/releases/tag/v2.45.0)
[Compare Source](https://togithub.com/gofiber/fiber/compare/v2.44.0...v2.45.0)
#### ๐ New
- Add filesystem config contentTypeCharset support ([#2438](https://togithub.com/gofiber/fiber/issues/2438))
https://docs.gofiber.io/api/middleware/filesystem#default-config
#### ๐งน Updates
- Consistent way of logging and fix middleware log format ([#2432](https://togithub.com/gofiber/fiber/issues/2432), [#2444](https://togithub.com/gofiber/fiber/issues/2444))
- Improve error handling for net error(s) ([#2421](https://togithub.com/gofiber/fiber/issues/2421))
- Bump golang.org/x/sys from 0.7.0 to 0.8.0 ([#2449](https://togithub.com/gofiber/fiber/issues/2449))
- Bump github.com/valyala/fasthttp from 1.45.0 to 1.47.0 ([#2426](https://togithub.com/gofiber/fiber/issues/2426), [#2445](https://togithub.com/gofiber/fiber/issues/2445))
#### ๐ Fixes
- Middleware/cors: Changed condition for 'AllowOriginsFunc' ([#2423](https://togithub.com/gofiber/fiber/issues/2423))
#### ๐ Documentation
- Correct errors in Italian translation ([#2417](https://togithub.com/gofiber/fiber/issues/2417))
- Correct grammar errors in Azerbaijani translation. ([#2413](https://togithub.com/gofiber/fiber/issues/2413))
**Full Changelog**: https://github.com/gofiber/fiber/compare/v2.44.0...v2.45.0
Thank you [@Jamess-Lucass](https://togithub.com/Jamess-Lucass), [@baichangda](https://togithub.com/baichangda), [@carmeloriolo](https://togithub.com/carmeloriolo), [@kanansnote](https://togithub.com/kanansnote) and [@kousikmitra](https://togithub.com/kousikmitra) for making this update possible.
### [`v2.44.0`](https://togithub.com/gofiber/fiber/releases/tag/v2.44.0)
[Compare Source](https://togithub.com/gofiber/fiber/compare/v2.43.0...v2.44.0)
#### ๐ New
- Added new 'AllowOriginsFunc' function. ([#2394](https://togithub.com/gofiber/fiber/issues/2394))
https://docs.gofiber.io/api/middleware/cors#config
๐ฎ Security hint
**Note: Using this feature is discouraged in production and it's best practice to explicitly set CORS origins via AllowOrigins.**
In this example any origin will be allowed via CORS.
For example, if a browser running on http://localhost:3000 sends a request, this will be accepted and the access-control-allow-origin response header will be set to http://localhost:3000.
```go
app.Use(cors.New(cors.Config{
AllowOriginsFunc: func(origin string) bool {
return os.Getenv("ENVIRONMENT") == "development"
},
}))
```
- Public ShutdownWithContext ([#2407](https://togithub.com/gofiber/fiber/issues/2407))
https://docs.gofiber.io/api/app#server-shutdown
#### ๐งน Updates
- Bump golang.org/x/sys from 0.6.0 to 0.7.0 ([#2405](https://togithub.com/gofiber/fiber/issues/2405))
- github/workflows: also run tests with Go 1.19.x ([#2384](https://togithub.com/gofiber/fiber/issues/2384))
- Bump github.com/mattn/go-isatty from 0.0.17 to 0.0.18 ([#2381](https://togithub.com/gofiber/fiber/issues/2381))
#### ๐ Fixes
- Middleware/logger: Fix [#2396](https://togithub.com/gofiber/fiber/issues/2396), data race logger middleware ([#2397](https://togithub.com/gofiber/fiber/issues/2397))
- Middleware/timeout: Add original timeout middleware ([#2367](https://togithub.com/gofiber/fiber/issues/2367))
https://docs.gofiber.io/next/api/middleware/timeout
โWith version [v2.38.1](https://togithub.com/gofiber/fiber/releases/tag/v2.38.1) we changed the behavior of the timeout function, this has now been undone and a function for use with context has been provided
- Mounted subapps don't work correctly if parent app attached ([#2331](https://togithub.com/gofiber/fiber/issues/2331))
- Change default value of Querybool from true to false. ([#2391](https://togithub.com/gofiber/fiber/issues/2391))
โThe fallback value for not found or not boolean values was adjusted to the golang standard
- Fix [#2383](https://togithub.com/gofiber/fiber/issues/2383), accepts mimeType ([#2386](https://togithub.com/gofiber/fiber/issues/2386))
#### ๐ Documentation
- Added Azerbaijani README translation ([#2411](https://togithub.com/gofiber/fiber/issues/2411))
- Fix import and comma issues ([#2410](https://togithub.com/gofiber/fiber/issues/2410))
- Fix typos, and make middleware documentation more consistent ([#2408](https://togithub.com/gofiber/fiber/issues/2408))
- Added code link to fiber config fields ([#2385](https://togithub.com/gofiber/fiber/issues/2385))
- Adding to fac sub domain routing ([#2393](https://togithub.com/gofiber/fiber/issues/2393))
**Full Changelog**: https://github.com/gofiber/fiber/compare/v2.43.0...v2.44.0
Thank you [@Jamess-Lucass](https://togithub.com/Jamess-Lucass), [@ancogamer](https://togithub.com/ancogamer), [@cmd777](https://togithub.com/cmd777), [@dozheiny](https://togithub.com/dozheiny), [@eld4niz](https://togithub.com/eld4niz), [@hakankutluay](https://togithub.com/hakankutluay), [@jcyamacho](https://togithub.com/jcyamacho), [@leonklingele](https://togithub.com/leonklingele) and [@shahriarsohan](https://togithub.com/shahriarsohan) for making this update possible.
### [`v2.43.0`](https://togithub.com/gofiber/fiber/releases/tag/v2.43.0)
[Compare Source](https://togithub.com/gofiber/fiber/compare/v2.42.0...v2.43.0)
#### โ BreakingChange
- Drop go 1.16 support & update to fasthttp 1.45.0 ([#2374](https://togithub.com/gofiber/fiber/issues/2374))
**Due to the fact that fasthttp, which fiber is based on in release [1.45.0](https://togithub.com/valyala/fasthttp/releases/tag/v1.45.0), does not support go version 1.16 anymore, we had to remove it from our package as well.**
#### ๐ New
- Allow preloaded certs with prefork ([#2351](https://togithub.com/gofiber/fiber/issues/2351))
https://docs.gofiber.io/api/app#listentlswithcertificate
https://docs.gofiber.io/api/app#listenmutualtlswithcertificate
```go
app.ListenTLSWithCertificate(":443", cert);
```
```go
app.ListenMutualTLSWithCertificate(":443", cert, clientCertPool);
```
- Add queryBool parser ([#2329](https://togithub.com/gofiber/fiber/issues/2329))
https://docs.gofiber.io/api/ctx#querybool
```go
// GET http://example.com/?name=alex&want_pizza=false&id=
app.Get("/", func(c *fiber.Ctx) error {
c.QueryBool("want_pizza") // false
c.QueryBool("want_pizza", true) // false
c.QueryBool("alex") // true
c.QueryBool("alex", false) // false
c.QueryBool("id") // true
c.QueryBool("id", false) // false
// ...
})
```
- Add queryFloat parser ([#2328](https://togithub.com/gofiber/fiber/issues/2328))
https://docs.gofiber.io/api/ctx#queryfloat
```go
// GET http://example.com/?name=alex&amount=32.23&id=
app.Get("/", func(c *fiber.Ctx) error {
c.QueryFloat("amount") // 32.23
c.QueryFloat("amount", 3) // 32.23
c.QueryFloat("name", 1) // 1
c.QueryFloat("name") // 0
c.QueryFloat("id", 3) // 3
// ...
})
```
- Middleware/session: SessionOnly when cookie.Expires is 0 ([#2152](https://togithub.com/gofiber/fiber/issues/2152))
https://docs.gofiber.io/api/middleware/session
```go
session.New(session.Config{
// Decides whether cookie should last for only the browser sesison.
CookieSessionOnly: true,
})
```
- Middleware/proxy: Add DoRedirects, DoTimeout and DoDeadline to Proxy middleware ([#2332](https://togithub.com/gofiber/fiber/issues/2332))
https://docs.gofiber.io/api/middleware/proxy
```go
// DoRedirects performs the given http request and fills the given http response while following up to maxRedirectsCount redirects.
func DoRedirects(c *fiber.Ctx, addr string, maxRedirectsCount int, clients ...*fasthttp.Client) error
// DoDeadline performs the given request and waits for response until the given deadline.
func DoDeadline(c *fiber.Ctx, addr string, deadline time.Time, clients ...*fasthttp.Client) error
// DoTimeout performs the given request and waits for response during the given timeout duration.
func DoTimeout(c *fiber.Ctx, addr string, timeout time.Duration, clients ...*fasthttp.Client) error
```
#### ๐งน Updates
- Get mime fallback ([#2340](https://togithub.com/gofiber/fiber/issues/2340))
- Middleware/requestid: don't call "Generator" func on existing request ID header ([#2371](https://togithub.com/gofiber/fiber/issues/2371))
- Middleware/basicauth: Optimize Basic auth alloc ([#2333](https://togithub.com/gofiber/fiber/issues/2333))
#### ๐ Fixes
- Middleware/requestid: Config.ContextKey is interface{} ([#2369](https://togithub.com/gofiber/fiber/issues/2369))
- Middleware/cors: Fix cors \* behavior [#2338](https://togithub.com/gofiber/fiber/issues/2338) ([#2339](https://togithub.com/gofiber/fiber/issues/2339))
#### ๐ Documentation
- Use proper discord invitation link ([#2382](https://togithub.com/gofiber/fiber/issues/2382))
- Corrected coding typos in MountPath docs section ([#2379](https://togithub.com/gofiber/fiber/issues/2379))
- Fix typo in docs ([#2357](https://togithub.com/gofiber/fiber/issues/2357))
- Fix(docs): add missing comma ([#2353](https://togithub.com/gofiber/fiber/issues/2353))
- Fix all inaccessible links in docs ([#2349](https://togithub.com/gofiber/fiber/issues/2349))
- Automated synchronization with `gofiber/docs` ([#2344](https://togithub.com/gofiber/fiber/issues/2344))
**Full Changelog**: https://github.com/gofiber/fiber/compare/v2.42.0...v2.43.0
Thank you [@CaioAugustoo](https://togithub.com/CaioAugustoo), [@HHongSeungWoo](https://togithub.com/HHongSeungWoo), [@IwateKyle](https://togithub.com/IwateKyle), [@Rorke76753](https://togithub.com/Rorke76753), [@Skyenought](https://togithub.com/Skyenought), [@UtopiaGitHub](https://togithub.com/UtopiaGitHub), [@benjajaja](https://togithub.com/benjajaja), [@derkan](https://togithub.com/derkan), [@dozheiny](https://togithub.com/dozheiny), [@efectn](https://togithub.com/efectn), [@gaby](https://togithub.com/gaby), [@leonklingele](https://togithub.com/leonklingele), [@lublak](https://togithub.com/lublak), [@msaf1980](https://togithub.com/msaf1980), [@ryand67](https://togithub.com/ryand67) and [@yvestumushimire](https://togithub.com/yvestumushimire) for making this update possible.
### [`v2.42.0`](https://togithub.com/gofiber/fiber/releases/tag/v2.42.0)
[Compare Source](https://togithub.com/gofiber/fiber/compare/v2.41.0...v2.42.0)
#### ๐ New
- Ctx: Context method for query paramters with numbers ([#2306](https://togithub.com/gofiber/fiber/issues/2306))
https://docs.gofiber.io/api/ctx#queryint
```go
// GET http://example.com/?id=5555
app.Get("/", func(c *fiber.Ctx) error {
c.QueryInt("id", 1) // 5555
// ...
})
```
- Middleware/earlydata: Add earlydata middleware (v2 backport) ([#2314](https://togithub.com/gofiber/fiber/issues/2314))
https://docs.gofiber.io/api/middleware/earlydata
> adds support for TLS 1.3's early data ("0-RTT") feature
```go
app.Use(earlydata.New())
```
- Middleware/idempotency: Add idempotency middleware (v2 backport) ([#2288](https://togithub.com/gofiber/fiber/issues/2288))
https://docs.gofiber.io/api/middleware/idempotency
> allows for fault-tolerant APIs where duplicate requests โ for example due to networking issues on the client-side โ do not erroneously cause the same action performed multiple times on the server-side.
```go
app.Use(idempotency.New(idempotency.Config{
Lifetime: 42 * time.Minute,
// ...
}))
```
- Middleware/proxy: Add forward from domain ([#2323](https://togithub.com/gofiber/fiber/issues/2323))
https://docs.gofiber.io/api/middleware/proxy
```go
// If you want to forward with a specific domain. You have to use proxy.DomainForward.
app.Get("/payments", proxy.DomainForward("docs.gofiber.io", "http://localhost:8000"))
// Or this way if the balancer is using https and the destination server is only using http.
app.Use(proxy.BalancerForward([]string{
"http://localhost:3001",
"http://localhost:3002",
"http://localhost:3003",
}))
```
#### ๐งน Updates/CI
- Middleware/favicon: Add url for favicon middleware, for correct handling different ofโฆ ([#2231](https://togithub.com/gofiber/fiber/issues/2231))
https://docs.gofiber.io/api/middleware/favicon
- CI: Add go 1.20 to ci and readmes ([#2322](https://togithub.com/gofiber/fiber/issues/2322))
- CI: Add and apply more stricter golangci-lint linting rules ([#2286](https://togithub.com/gofiber/fiber/issues/2286))
- CI: Added testcases and minor algorithm improvment ([#2308](https://togithub.com/gofiber/fiber/issues/2308))
- CI: Make most tests parallel ([#2299](https://togithub.com/gofiber/fiber/issues/2299))
- CI: Bump github.com/valyala/fasthttp from 1.43.0 to 1.44.0 ([#2292](https://togithub.com/gofiber/fiber/issues/2292))
#### ๐ Fixes
- CI: Fix issues introduced in linting PR ([#2319](https://togithub.com/gofiber/fiber/issues/2319))
- Use `app.getString, app.GetBytes` instead of `utils.UnsafeString, utils.UnsafeBytes` in `ctx.go` ([#2297](https://togithub.com/gofiber/fiber/issues/2297))
- Os: Fix gopsutil compilation ([#2298](https://togithub.com/gofiber/fiber/issues/2298))
- Middleware/logger: logger color output ([#2296](https://togithub.com/gofiber/fiber/issues/2296))
#### ๐ Documentation
- Rework Chinese (Taiwan) translation of documentation ([#2310](https://togithub.com/gofiber/fiber/issues/2310))
- Correct the figure link in READMEs ([#2312](https://togithub.com/gofiber/fiber/issues/2312))
- Remove the redundant space beside a comma ([#2309](https://togithub.com/gofiber/fiber/issues/2309))
- Add discord channel link (ID) ([#2303](https://togithub.com/gofiber/fiber/issues/2303))
- Middleware/filesystem: fix statik filesystem middleware example typo ([#2302](https://togithub.com/gofiber/fiber/issues/2302))
- Middleware/filesystem: clean duplicated namespace for example ([#2313](https://togithub.com/gofiber/fiber/issues/2313))
- Middleware/limiter: fix alignment in limiter example ([#2283](https://togithub.com/gofiber/fiber/issues/2283))
- Middleware/encryptcookie: Openssl rand -base64 32 hints ([#2316](https://togithub.com/gofiber/fiber/issues/2316))
**Full Changelog**: https://github.com/gofiber/fiber/compare/v2.41.0...v2.42.0
Thank you [@0xdeface](https://togithub.com/0xdeface), [@100gle](https://togithub.com/100gle), [@TwiN](https://togithub.com/TwiN), [@cloudwindy](https://togithub.com/cloudwindy), [@dozheiny](https://togithub.com/dozheiny), [@efectn](https://togithub.com/efectn), [@leonklingele](https://togithub.com/leonklingele), [@meehow](https://togithub.com/meehow), [@pan93412](https://togithub.com/pan93412), [@rendiputra](https://togithub.com/rendiputra) and [@rhabichl](https://togithub.com/rhabichl) for making this update possible.
### [`v2.41.0`](https://togithub.com/gofiber/fiber/releases/tag/v2.41.0)
[Compare Source](https://togithub.com/gofiber/fiber/compare/v2.40.1...v2.41.0)
#### ๐ New
- Add ShutdownWithTimeout function ([#2228](https://togithub.com/gofiber/fiber/issues/2228))
https://docs.gofiber.io/api/app#server-shutdown
- Match function ([#2142](https://togithub.com/gofiber/fiber/issues/2142))
https://pkg.go.dev/github.com/gofiber/fiber/v2#RoutePatternMatch
#### ๐งน Updates
- Latency use lowest time unit in logger middleware ([#2261](https://togithub.com/gofiber/fiber/issues/2261))
- Add more detail error message in serverErrorHandler ([#2267](https://togithub.com/gofiber/fiber/issues/2267))
- Use fasthttp.AddMissingPort ([#2268](https://togithub.com/gofiber/fiber/issues/2268))
- Set byteSent log to 0 when use SetBodyStreamWriter ([#2239](https://togithub.com/gofiber/fiber/issues/2239))
- Unintended overwritten bind variables ([#2240](https://togithub.com/gofiber/fiber/issues/2240))
- Bump github.com/valyala/fasthttp from 1.41.0 to 1.43.0 ([#2237](https://togithub.com/gofiber/fiber/issues/2237), [#2245](https://togithub.com/gofiber/fiber/issues/2245))
- Bump github.com/mattn/go-isatty from 0.0.16 to 0.0.17 ([#2279](https://togithub.com/gofiber/fiber/issues/2279))
#### ๐ Fixes
- Fix some warnings, go-ole on mac os ([#2280](https://togithub.com/gofiber/fiber/issues/2280))
- Properly handle error of "net.ParseCIDR" in "(\*App).handleTrustedProxy" ([#2243](https://togithub.com/gofiber/fiber/issues/2243))
- Fix regex constraints that contain comma ([#2256](https://togithub.com/gofiber/fiber/issues/2256))
- Unintended overwritten bind variables ([#2240](https://togithub.com/gofiber/fiber/issues/2240))
#### ๐ Documentation
- Fix ci badge errors ([#2282](https://togithub.com/gofiber/fiber/issues/2282))
- Replace `1.14` with `1.16` in READMEs ([#2265](https://togithub.com/gofiber/fiber/issues/2265))
- Update docstring for FormValue() ([#2262](https://togithub.com/gofiber/fiber/issues/2262))
- Added Ukrainian README translation ([#2249](https://togithub.com/gofiber/fiber/issues/2249))
- middleware/requestid: mention that the default UUID generator exposes the number of requests made to the server ([#2241](https://togithub.com/gofiber/fiber/issues/2241))
- middleware/filesystem does not handle url encoded values on it's own ([#2247](https://togithub.com/gofiber/fiber/issues/2247))
**Full Changelog**: https://github.com/gofiber/fiber/compare/v2.40.1...v2.41.0
Thank you [@AngelVI13](https://togithub.com/AngelVI13), [@Simerax](https://togithub.com/Simerax), [@cwinters8](https://togithub.com/cwinters8), [@efectn](https://togithub.com/efectn), [@jfcg](https://togithub.com/jfcg), [@leonklingele](https://togithub.com/leonklingele), [@li-jin-gou](https://togithub.com/li-jin-gou), [@pjebs](https://togithub.com/pjebs), [@shuuji3](https://togithub.com/shuuji3) and [@v1def](https://togithub.com/v1def) for making this update possible.
### [`v2.40.1`](https://togithub.com/gofiber/fiber/releases/tag/v2.40.1)
[Compare Source](https://togithub.com/gofiber/fiber/compare/v2.40.0...v2.40.1)
#### ๐ Fixes
- Fix mounting when mount prefix is `/` ([#2227](https://togithub.com/gofiber/fiber/issues/2227))
**Full Changelog**: https://github.com/gofiber/fiber/compare/v2.40.0...v2.40.1
### [`v2.40.0`](https://togithub.com/gofiber/fiber/releases/tag/v2.40.0)
[Compare Source](https://togithub.com/gofiber/fiber/compare/v2.39.0...v2.40.0)
#### โ BreakingChange
- Bump github.com/valyala/fasthttp from 1.40.0 to 1.41.0 ([#2171](https://togithub.com/gofiber/fiber/issues/2171))
- Deprecate: go 1.14 & go 1.15 support deprecation ([#2172](https://togithub.com/gofiber/fiber/issues/2172))
**Due to the fact that fasthttp, which fiber is based on in release [1.41.0](https://togithub.com/valyala/fasthttp/releases/tag/v1.41.0), does not support go versions 1.14 & 1.15 anymore, we had to remove them from our package as well.**
#### ๐ New
- Register custom methods ([#2107](https://togithub.com/gofiber/fiber/issues/2107))
https://docs.gofiber.io/api/fiber#config
```go
// now you can add your own custom methods
app := fiber.New(fiber.Config{
RequestMethods: append(fiber.DefaultMethods, "LOAD", "TEST"),
})
app.Add("LOAD", "/hello", func(c *fiber.Ctx) error {
return c.SendString("Hello, World ๐!")
})
```
- Add multiple-prefix support to app.Use() and group.Use() ([#2205](https://togithub.com/gofiber/fiber/issues/2205))
https://docs.gofiber.io/api/app#route-handlers - More like [Express](https://expressjs.com/en/5x/api.html#path-examples)
```go
// declaration of multiple paths for the ".Use" method as in express is now possible
app.Use([]string{"/john", "/doe"}, func(c *Ctx) error {
return c.SendString(c.Path())
})
```
- Allow optional params with route constraints ([#2179](https://togithub.com/gofiber/fiber/issues/2179))
https://docs.gofiber.io/guide/routing#constraints
```go
app.Get("/:userId?", func(c *fiber.Ctx) error {
return c.SendString(c.Params("userId"))
})
// curl -X GET http://localhost:3000/42
// 42
// curl -X GET http://localhost:3000/
//
```
- Improve mounting behavior ([#2120](https://togithub.com/gofiber/fiber/issues/2120))
https://docs.gofiber.io/api/app#mount https://docs.gofiber.io/api/app#mountpath
```go
app := fiber.New()
micro := fiber.New()
// order when registering the mounted apps no longer plays a role
app.Mount("/john", micro)
// before there was problem when after mounting routes were registered
micro.Get("/doe", func(c *fiber.Ctx) error {
return c.SendStatus(fiber.StatusOK)
})
```
```go
// output of the mount path possible
micro.MountPath() // "/john"
```
- Middleware/pprof: Add URL prefix to pprof middleware ([#2194](https://togithub.com/gofiber/fiber/issues/2194))
https://docs.gofiber.io/api/middleware/pprof
```go
// In systems where you have multiple ingress endpoints, it is common to add a URL prefix, like so:
app.Use(pprof.New(pprof.Config{Prefix: "/endpoint-prefix"}))
```
- Middleware/logger: Add customTags in Config ([#2188](https://togithub.com/gofiber/fiber/issues/2188), [#2224](https://togithub.com/gofiber/fiber/issues/2224), [#2225](https://togithub.com/gofiber/fiber/issues/2225))
https://docs.gofiber.io/api/middleware/logger#add-custom-tags
```go
app.Use(logger.New(logger.Config{
Format: "[${time}] ${status} - ${latency} ${method} ${randomNumber} ${path}\n",
CustomTags: map[string]logger.LogFunc{
// possibility to adapt or overwrite existing tags
logger.TagMethod: func(output logger.Buffer, c *fiber.Ctx, data *logger.Data, extraParam string) (int, error) {
return output.WriteString(utils.ToLower(c.Method()))
},
// own tags can be registered
"randomNumber": func(output logger.Buffer, c *fiber.Ctx, data *logger.Data, extraParam string) (int, error) {
return output.WriteString(strconv.FormatInt(rand.Int63n(100), 10))
},
},
}))
// [17:15:17] 200 - 0s get 10 /test
// [17:15:17] 200 - 0s get 51 /test
```
- Middleware/logger: Add callback function ([#2219](https://togithub.com/gofiber/fiber/issues/2219))
https://docs.gofiber.io/api/middleware/logger#callback-after-log-is-written
```go
app.Use(logger.New(logger.Config{
// is triggered when the handlers has been processed
Done: func(c *fiber.Ctx, logString []byte) {
// allows saving the logging string to other sources
if c.Response().StatusCode() != fiber.StatusOK {
reporter.SendToSlack(logString)
}
},
}))
```
#### ๐งน Updates
- Track Configured Values ([#2221](https://togithub.com/gofiber/fiber/issues/2221))
- Ctx: simplify Protocol() ([#2217](https://togithub.com/gofiber/fiber/issues/2217))
- Ctx: make Secure() also report whether a secure connection was established to a trusted proxy ([#2215](https://togithub.com/gofiber/fiber/issues/2215))
- Ctx: update Locals function to accept interface{} key ([#2144](https://togithub.com/gofiber/fiber/issues/2144))
- Utils: reduce diff to external utils package ([#2206](https://togithub.com/gofiber/fiber/issues/2206))
- Utils: Update HTTP status codes ([#2203](https://togithub.com/gofiber/fiber/issues/2203))
- Utils: Replace UnsafeBytes util with suggested way ([#2204](https://togithub.com/gofiber/fiber/issues/2204))
- Fix and optimize memory storage ([#2207](https://togithub.com/gofiber/fiber/issues/2207))
- Leverage runtime/debug to print the full stack trace info ([#2183](https://togithub.com/gofiber/fiber/issues/2183))
- Ci: add check-latest param in vulncheck.yml ([#2197](https://togithub.com/gofiber/fiber/issues/2197))
- Ci: replace snyk with govulncheck ([#2178](https://togithub.com/gofiber/fiber/issues/2178))
#### ๐ Fixes
- Fix naming of routes inside groups ([#2199](https://togithub.com/gofiber/fiber/issues/2199))
#### ๐ Documentation
- Update list of third-party library licenses ([#2211](https://togithub.com/gofiber/fiber/issues/2211))
- Update README_zh-CN.md ([#2186](https://togithub.com/gofiber/fiber/issues/2186))
- Add korean translate in Installation section ([#2213](https://togithub.com/gofiber/fiber/issues/2213))
- Comment typo ([#2173](https://togithub.com/gofiber/fiber/issues/2173))
- Cache readme and docs update ([#2169](https://togithub.com/gofiber/fiber/issues/2169))
**Full Changelog**: https://github.com/gofiber/fiber/compare/v2.39.0...v2.40.0
Thank you [@Skyenought](https://togithub.com/Skyenought), [@calebcase](https://togithub.com/calebcase), [@efectn](https://togithub.com/efectn), [@gandaldf](https://togithub.com/gandaldf), [@gmlewis](https://togithub.com/gmlewis), [@jamestiotio](https://togithub.com/jamestiotio), [@leonklingele](https://togithub.com/leonklingele), [@li-jin-gou](https://togithub.com/li-jin-gou), [@marcmartin13](https://togithub.com/marcmartin13), [@panjf2000](https://togithub.com/panjf2000), [@pjebs](https://togithub.com/pjebs), [@rafimuhammad01](https://togithub.com/rafimuhammad01) and [@thor-son](https://togithub.com/thor-son) for making this update possible.
### [`v2.39.0`](https://togithub.com/gofiber/fiber/releases/tag/v2.39.0)
[Compare Source](https://togithub.com/gofiber/fiber/compare/v2.38.1...v2.39.0)
#### ๐ New
- Middleware/cache: Cache-Control: no-cache/no-store ([#2159](https://togithub.com/gofiber/fiber/issues/2159))
https://docs.gofiber.io/api/middleware/cache
- Middleware/proxy: support to set client ([#2117](https://togithub.com/gofiber/fiber/issues/2117))
https://docs.gofiber.io/api/middleware/proxy
- Add GetRoutes ([#2112](https://togithub.com/gofiber/fiber/issues/2112))
https://docs.gofiber.io/api/app#getroutes
- Static: add CacheControl to Static config ([#2140](https://togithub.com/gofiber/fiber/issues/2140))
https://docs.gofiber.io/api/app#static
#### ๐งน Updates
- Improve memory storage ([#2162](https://togithub.com/gofiber/fiber/issues/2162))
- Make IP validation 2x faster ([#2158](https://togithub.com/gofiber/fiber/issues/2158))
- Switch to text/javascript as per RFC9239 ([#2146](https://togithub.com/gofiber/fiber/issues/2146))
- Test: add nil jsonDecoder test case ([#2139](https://togithub.com/gofiber/fiber/issues/2139))
- Utils: update mime extensions ([#2133](https://togithub.com/gofiber/fiber/issues/2133))
#### ๐ Fixes
- Unhandled errors and update code comments to help the IDEs ([#2128](https://togithub.com/gofiber/fiber/issues/2128))
- Multi-byte AppName displays confusion
This PR contains the following updates:
v2.1.4
->v2.52.1
By merging this PR, the issue #319 will be automatically resolved and closed:
Release Notes
gofiber/fiber (github.com/gofiber/fiber/v2)
### [`v2.52.1`](https://togithub.com/gofiber/fiber/releases/tag/v2.52.1) [Compare Source](https://togithub.com/gofiber/fiber/compare/v2.52.0...v2.52.1) #### ๐ฎ SecurityMiddleware/cors: Insecure CORS Configuration Allowing Wildcard Origin with Credentials - GHSA-fmg4-x8pw-hjhg
https://docs.gofiber.io/api/middleware/corsMiddleware/csrf: Token Vulnerability (GHSA-mv73-f69x-444p, GHSA-94w9-97p3-p368)
https://docs.gofiber.io/api/middleware/csrf ๐ Improvements to the CSRF middleware: - Added support for single-use tokens through the `SingleUseToken` configuration option. - Optional integration with GoFiber session middleware through the `Session` and `SessionKey` configuration options. - Introduction of origin checks for HTTPS connections to verify referer headers. - Implementation of a Double Submit Cookie approach for CSRF token generation and validation when used without `Session`. - Enhancement of error handling with more descriptive error messages. - The documentation for the CSRF middleware has been enhanced with the addition of the new options and best practices to improve security. Thank you [@sixcolors](https://togithub.com/sixcolors)๐ฎ Security hint
**Note: Using this feature is discouraged in production and it's best practice to explicitly set CORS origins via AllowOrigins.** In this example any origin will be allowed via CORS. For example, if a browser running on http://localhost:3000 sends a request, this will be accepted and the access-control-allow-origin response header will be set to http://localhost:3000.