<p>I am trying to configure my K8s app with TLS. I have 2 containers in that pod, one is OAuth2.0 proxy container and the other container has my backend code.</p>
<p>I am using OAuth2.0 for doing that. So basically, in the OAuth2.0 proxy pod, I provide tls-cert-file and tls-key-file. As I am using OAuth2.0 for authorisation, I figured I can use the same pod to enable HTTPS. However, after OAuth provider redirects to my application, I get 502 bad gateway.</p>
<p>This is the error I obtain in the OAuth container:</p>
<pre><code>Error proxying to upstream server: tls: first record does not look like a TLS handshake
</code></pre>
<p>Now I am wondering is this I have configured TLS only on OAuth container and not the backend container?</p>
<p>Or is this something else and configuring TLS on OAuth container is enough?</p>

codego123
<p>After some more tinkering I figured out what was wrong. The error I mentioned above basically means that we're trying to send HTTPS request to a server that typically takes HTTP request.</p>
<p>In my OAuth proxy conf, I had changed <code>upstream</code> to <code>https</code> whereas it should be <code>HTTP</code>.</p>
<p>I was able to establish an end to end encrypted connection after making this change.</p>
