Skip to content

🐛 [Bug]: Healthcheck middleware doesn't work with group #2860

@ulasakdeniz

Description

@ulasakdeniz

Bug Description

Hi, I have a problem with running healthcheck middleware with a group:

package main

import (
	"github.com/gofiber/fiber/v2"
	"github.com/gofiber/fiber/v2/middleware/compress"
	"github.com/gofiber/fiber/v2/middleware/healthcheck"
	"github.com/gofiber/fiber/v2/middleware/recover"
)

func main() {
	app := fiber.New()

	app.Use(recover.New())
	app.Use(compress.New())

	group := app.Group("/app")
	group.Use(healthcheck.New())

	group.Get("/hello", func(c *fiber.Ctx) error {
		return c.SendString("Hello, World 👋!")
	})

	err := app.Listen(":5001")
	if err != nil {
		panic(err)
	}
}
  • localhost:5001/app/livez doesn't work:
    curl localhost:5001/app/livez
    Cannot GET /app/livez
  • localhost:5001/app/hello works

How to Reproduce

Steps to reproduce the behavior:

  1. Run the main file above
  2. Run curl localhost:5001/app/livez
  3. It returns not found.

Expected Behavior

The endpoint should return HTTP 200

Fiber Version

v2.52.0

Code Snippet (optional)

No response

Checklist:

  • I agree to follow Fiber's Code of Conduct.
  • I have checked for existing issues that describe my problem prior to opening this one.
  • I understand that improperly formatted bug reports may be closed without explanation.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions