<p>I am experiencing this issue. My application needs to receive connection under SSL only with WebSocket. HTTP requests should be forced to not being redirected. My ingress configuration is </p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
 name: in-camonline
 namespace: cl5
 annotations: 
  kubernetes.io/ingress.class: "nginx"
  nginx.org/websocket-services: "svc-ws-api"
  nginx.ingress.kubernetes.io/ssl-redirect: "false"
  nginx.ingress.kubernetes.io/force-ssl-redirect: "false"
  ingress.kubernetes.io/affinity: "ClientIP"
spec:
 tls:
  - hosts:
    - foo.bar.com
    secretName: cl5-secret
 rules:
 - host:  foo.bar.com
   http:
    paths:
     - path: /socket.io
       backend:
        serviceName: svc-ws-api
        servicePort: 8000
     - path: /
       backend:
        serviceName: svc-http-service
        servicePort: 80
</code></pre>

<p>I also disabled the <code>ssl-redirect</code> globally adding an item into the ConfigMap</p>

<pre><code>kind: ConfigMap
apiVersion: v1
metadata:
  name: nginx-configuration
  namespace: ingress
  labels:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
data:
        #use-proxy-protocol: "false"
 ssl-redirect: "false"
</code></pre>

<p>Now if I do request using curl, requests won't being redirected. If I try to run my front-end application every request after the WSS will be forced to being redirected to use HTTPS </p>

<pre><code>Request URL: http://foo.bar.com/2/symbols
Request Method: OPTIONS
Status Code: 307 Internal Redirect
Referrer Policy: no-referrer-when-downgrade
</code></pre>

<p>Any suggestion about how to achieve that? </p>

Giorgio Cerruti
<p>Finally, I sorted it out. If someone is reading this, easy you are not alone!</p>

<p>Jokes aside, <code>nginx-controller</code> was setting header <code>Strict-Transport-Security</code> after the first HTTPS call (socket.io polling in my case). This header forces the browser to use TLS for the next requests. You can read more about this header here <a href="https://developer.mozilla.org/it/docs/Web/HTTP/Headers/Strict-Transport-Security" rel="nofollow noreferrer">https://developer.mozilla.org/it/docs/Web/HTTP/Headers/Strict-Transport-Security</a></p>

<p>What I did is to disable the option adding the entry <code>hsts: false</code> on the <code>ingress-controller</code>'s ConfigMap object. 
You can find more here <a href="https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#hsts" rel="nofollow noreferrer">https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#hsts</a>
Hope this can help you :)</p>
