Usually it’s better to bypass Cloud Flare for this kind of thing. They are very hostile to reverse proxies, and you might run into issues with it blocking your nginx VMs. If you can point directly to the GCP load balancer that will work better.
FROM nginx:1.19.7-alpine
ENV PORT 443
ENV NGINX_ENTRYPOINT_QUIET_LOGS 1
RUN rm -rf /etc/nginx/conf.d
COPY certs/ /etc/nginx/
COPY nginx.conf /etc/nginx/nginx.conf
My Fly app is up and running but no proxied content appears at all, each time I get this message:
400 Bad Request
The plain HTTP request was sent to HTTPS port
nginx/1.19.7
This is confusing as my Fly app listens only on SSL port and backend app I proxy to is also HTTPS-enabled Kubernetes ingress-nginx. Any ideas on why this weird error occur?
Fly.io apps should listen for http, not for SSL. We handle SSL for you and just make normal HTTP requests to your app (in this case, nginx). If you change your listen directive to this:
listen 80;
listen [::]:80;
And make sure the internal_port in fly.toml is set to 80, it should work.
Oh dang, sorry. I’ve been unavailable most of the week and lost this.
That original config I gave you should still work. But we also can’t really help much with k8s ingress + nginx. Those logs look like the kubernetes cluster is rejecting the connection or not serving SSL for some reason.