By TommyLeong
I’m setting up DO Load Balancer to access my service using Nginx Ingress Controller (without helm). From DO control panel, I can see my nodes are accepting traffic somehow the page throws me 400 bad request with error The plain HTTP request was sent to HTTPS port
.
Can one please point me out my mistake?
I wonder if this has anything to do with my health checks
? The application is exposing an endpoint to update health check 200, but application expose via port 3000 and health check URL is pointing to 80 atm.
Below’s the annontation use for my LB.
annotations:
service.beta.kubernetes.io/do-loadbalancer-name: random
service.beta.kubernetes.io/do-loadbalancer-protocol: "http"
service.beta.kubernetes.io/do-loadbalancer-tls-passthrough: "true"
service.beta.kubernetes.io/do-loadbalancer-tls-ports: "443"
service.beta.kubernetes.io/do-loadbalancer-certificate-id: "masked-my-cert-id"
service.beta.kubernetes.io/do-loadbalancer-disable-lets-encrypt-dns-records: "false"
service.beta.kubernetes.io/do-loadbalancer-redirect-http-to-https: "true"
service.beta.kubernetes.io/do-loadbalancer-healthcheck-port: "3000"
service.beta.kubernetes.io/do-loadbalancer-healthcheck-protocol: "http"
service.beta.kubernetes.io/do-loadbalancer-healthcheck-path: "/api/healthcheck"
service.beta.kubernetes.io/do-loadbalancer-healthcheck-check-interval-seconds: "3"
service.beta.kubernetes.io/do-loadbalancer-healthcheck-response-timeout-seconds: "5"
service.beta.kubernetes.io/do-loadbalancer-healthcheck-unhealthy-threshold: "3"
service.beta.kubernetes.io/do-loadbalancer-healthcheck-healthy-threshold: "5"
Screenshot FYR
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted Answer
Resolved my issue.
I need to expose port 443 for my Ingress
. I did this by setting up the TLS
.
Hey @TommyLeong,
Do you by any chance see any additional messages in your logs? You could try checking the logs for your Ingress Controller and application pods. The logs can provide insights into whether they’re receiving and correctly handling the traffic forwarded by the LoadBalancer.
Also, would you mind sharing your complete YAML file here so I could take a further look?
Besides that, the “400 Bad Request - The plain HTTP request was sent to HTTPS port” error is typically due to misconfigured protocol handling. Here are a few things that you could check:
Ensure your Nginx Ingress is set up to handle HTTPS. TLS passthrough requires that SSL termination happens at the pod level, so your Ingress must be configured accordingly.
Adjust the health check to use HTTPS if your service only listens for HTTPS, since the error suggests that an HTTP request is reaching an HTTPS port.
Make sure the service ports and protocols in your Kubernetes configuration match what’s expected by the Load Balancer.
For a detailed guide on setting up HTTPS with Nginx Ingress on DigitalOcean, check out this DigitalOcean tutorial.
Best,
Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.