-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
🤗 [Question]: How to use Balancer with https? #2307
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 |
i have found the same issue was reported a while ago: #1855 |
refer to https:/gofiber/fiber/blob/master/middleware/proxy/config.go#L51 and you can set tls.config when use Balancer or LbClient. |
thanks for the answer. I am a bit confused. On the other thread, someone wrote this was not implemented. you suggested a solution which does not work for me. is this feature working, or is it only me having problems getting it working? thank you very much.. |
I'll try |
@rosszfej Maybe you could try using the |
While this is technically interesting to implement it like you did, I would suggest to let other tools do the load balancing and TLS termination (e.g. Nginx, HAProxy or Traefik). Is it technically possible for you to use such tools or are you needed to implement the things as part of your application? For example, your application needs to be restarted, when you change your TLS certificate to load the new certificate file. |
That's true, it could also be done using a Proxy. It does no harm to implement this on Fiber itself though. |
hi all, thanks for the answers.. what finally did, i used nginx to handle https and used the HTTP load balancer in fiber. it's working fine this way.. thanks again. |
Question Description
I want to create a simple load balancer using Go. I have created a test version on my PC for HTTP using the examples on the https://docs.gofiber.io/api/middleware/proxy and it was working fine. I modified it for HTTPS and tried it on the production server but I was getting HTTP-500 response with the following text all the time:
HostClient can't follow redirects to a different protocol, please use Client instead
I googled this text and found that it's from fasthttp:
ErrHostClientRedirectToDifferentScheme = errors.New("HostClient can't follow redirects to a different protocol, please use Client instead")
I've found this bug report in fasthttp, which mentions
ErrHostClientRedirectToDifferentScheme
but I am not sure if this is related and even it is, I am not sure how to apply the workaround mentioned there in fiber:valyala/fasthttp#841
( I have modified my https implementation to work as a simple web server and it was working fine (there is no problem with the certificates, etc.. ), so i am pretty much sure that the problem is in the
Balancer
)This is the relevant part of my source code:
Really appreciate your help with this..
Code Snippet (optional)
No response
Checklist:
The text was updated successfully, but these errors were encountered: