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!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Resolved my issue.
I need to expose port 443 for my
Ingress
. I did this by setting up theTLS
.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