I am currently trying to redirect HTTP to HTTPS on my NGINX web server, however only for external connections. Internal connections such as a localhost should be able to access it via HTTP without being redirected. This is for the
readinessProbe for the Kubernetes (GKE) cluster this Docker container is running in. (And could be handy for development possibly.)
When I redirect ALL HTTP traffic to HTTPS, I believe the reason for the 400's is that I have
ssl_verify_client on, and so HTTPS connections must come through the domain name which Cloudflare will catch and verify.
Is there a means to conditionally redirect just the external connections without affecting local network?
The following is how my
nginx.conf currently looks like before any attempts to redirect to HTTPS: