Skip to content
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

proxy.Balancer middleware should handle http backend servers when using app.ListenTLS #2997

Open
ganlvtech opened this issue May 9, 2024 · 1 comment

Comments

@ganlvtech
Copy link

need add req.URI().SetScheme("http") in proxy.Balancer

req.SetRequestURI(utils.UnsafeString(req.RequestURI())) 
// NOTE: if req.isTLS is true, SetRequestURI keeps the scheme as https. 
// Reference: https://github.com/gofiber/fiber/issues/1762 
if scheme := getScheme(utils.UnsafeBytes(copiedURL)); len(scheme) > 0 { 
	req.URI().SetSchemeBytes(scheme) 
} 

req.SetRequestURI(utils.UnsafeString(req.RequestURI()))

copiedURL := utils.CopyString(addr)
req.SetRequestURI(copiedURL)
// NOTE: if req.isTLS is true, SetRequestURI keeps the scheme as https.
// Reference: https://github.com/gofiber/fiber/issues/1762
if scheme := getScheme(utils.UnsafeBytes(copiedURL)); len(scheme) > 0 {
req.URI().SetSchemeBytes(scheme)
}

Copy link

welcome bot commented May 9, 2024

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

@ganlvtech ganlvtech changed the title proxy.Balancer middleware should handle http backend servers with use app.ListenTLS proxy.Balancer middleware should handle http backend servers when using app.ListenTLS May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant