Skip to content

🐛 [Bug]: Adaptor + otelfiber issue #2641

Closed
@kperreau

Description

@kperreau

Bug Description

If I combine the Adaptor + Otelfiber contrib Middleware, the method c.BaseURL() return the wrong value. (http:// instead of http://localhost:3000)

How to Reproduce

Steps to reproduce the behavior:
Use Adaptor + otelfiber middleware, then call the c.BaseURL() method from an handler.

Expected Behavior

Having the right base url http://localhost:3000 in my case.

Fiber Version

v2.49.2

Code Snippet (optional)

import (
	"github.com/gofiber/contrib/otelfiber"
	"github.com/gofiber/fiber/v2"
	"github.com/gofiber/fiber/v2/middleware/adaptor"
	"net/http"
)

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

	app.Use(otelfiber.Middleware())

	app.Get("/test", func(c *fiber.Ctx) error {
		return c.SendString(c.BaseURL())
	})
	
	http.ListenAndServe(":3000", adaptor.FiberApp(app))
}

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

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions