-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 Can't get added header by proxy #947
Comments
Thanks for opening your first issue here! 🎉 Be sure to follow the issue template! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord |
Quick question, are you testing this with CORS requests specifically? |
Hi @Fenny , I tested without it too, same result. I should have removed it from example to avoid confusion. You can try it with this very minimal code: proxy: package main
import (
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/proxy"
)
func main() {
app := fiber.New()
app.Use(proxy.Balancer(proxy.Config{
Servers: []string{
"http://localhost:8001",
},
ModifyRequest: func(c *fiber.Ctx) error {
c.Set("hello", "world")
return nil
},
}))
app.Listen(":8000")
} server: package main
import "github.com/gofiber/fiber/v2"
func main() {
app := fiber.New()
app.All("/*", func(c *fiber.Ctx) error {
return c.SendString("hello "+c.Get("hello"))
})
app.Listen(":8001")
} run both, then |
I figured out. It looks like I have to use |
I will update the example 👍 |
Fiber version
v2.1.0
Issue description
Can't get the added header by proxy in targeted server.
Look at the following code, I can't get "test" header.
Code snippet
in targeted server
The text was updated successfully, but these errors were encountered: