<p>I want to run my app inside kubernetes cluster on https and expose it outside the cluster also over https. I created the <code>pod</code> and exposed the port <code>443</code>. After that I created a <code>ClusterIP</code> service which connects to the pod on port <code>443</code> and expose also port <code>443</code>. Lastly, I created an <code>ingress</code> which connects to the service on port <code>443</code>. I deployed all of these resources using helm chart on GKE. I use <code>NGINX Ingress</code> controller. You can find the chart <a href="https://github.com/b-rohit/https-app/tree/master/chart" rel="nofollow noreferrer">here</a>.</p>
<p>When I access the app internally in the cluster over https it works.</p>
<pre><code>curl https://my-nginx.https-app-64-production --cacert /etc/nginx/ssl/tls.crt
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Welcome to nginx!&lt;/title&gt;
&lt;style&gt;
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h1&gt;Welcome to nginx!&lt;/h1&gt;
&lt;p&gt;If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.&lt;/p&gt;

&lt;p&gt;For online documentation and support please refer to
&lt;a href=&quot;http://nginx.org/&quot;&gt;nginx.org&lt;/a&gt;.&lt;br/&gt;
Commercial support is available at
&lt;a href=&quot;http://nginx.com/&quot;&gt;nginx.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Thank you for using nginx.&lt;/em&gt;&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
<p>But when I access it using external url then I get below error.</p>
<pre><code>curl https://staging.vs-creator.iotcrawler.eu/
&lt;html&gt;
&lt;head&gt;&lt;title&gt;400 The plain HTTP request was sent to HTTPS port&lt;/title&gt;&lt;/head&gt;
&lt;body bgcolor=&quot;white&quot;&gt;
&lt;center&gt;&lt;h1&gt;400 Bad Request&lt;/h1&gt;&lt;/center&gt;
&lt;center&gt;The plain HTTP request was sent to HTTPS port&lt;/center&gt;
&lt;hr&gt;&lt;center&gt;nginx/1.9.1&lt;/center&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
<p>I am not able to figure out what is going wrong. I suspect it is to do with ingress controller configuration. Please help me on this.</p>

Rohit Bohara
<p>Use below annotation in ingress resourece</p>
<pre><code>nginx.ingress.kubernetes.io/backend-protocol: &quot;HTTPS&quot;
</code></pre>
<p>From the <a href="https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#backend-protocol" rel="noreferrer">docs</a></p>
<blockquote>
<p>Using backend-protocol annotations is possible to indicate how NGINX
should communicate with the backend service. (Replaces secure-backends
in older versions) Valid Values: HTTP, HTTPS, GRPC, GRPCS, AJP and
FCGI</p>
</blockquote>
<p>By default NGINX uses <code>HTTP</code> while forwarding the request to backend pod which leads to <code>400 The plain HTTP request was sent to HTTPS port</code> because the backend pod is expecting <code>HTTPS</code> request.</p>
