<p>I have a bare-metal kubernetes cluster (1.13) and am running nginx ingress controller (deployed via helm into the default namespace, v0.22.0).</p>

<p>I have an ingress in a different namespace that attempts to use the nginx controller.</p>

<pre><code>#ingress.yaml
kind: Ingress
apiVersion: extensions/v1beta1
metadata:
  name: myapp
annotations:
  kubernetes.io/backend-protocol: https
  nginx.ingress.kubernetes.io/enable-rewrite-log: "true"
  nginx.ingress.kubernetes.io/rewrite-target: "/$1"
spec:
  tls:
  - hosts:
    - my-host
    secretName: tls-cert
  rules:
  - host: my-host
    paths:
    - backend:
        servicename: my-service
        servicePort: https
      path: "/api/(.*)"
</code></pre>

<p>The nginx controller successfully finds the ingress, and says that there are endpoints. If I hit the endpoint, I get a 400, with no content. If I turn on <a href="https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/nginx-configuration/configmap.md#custom-http-errors" rel="nofollow noreferrer">custom-http-headers</a> then I get a 404 from nginx; my service is not being hit. According to <a href="https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#enable-rewrite-log" rel="nofollow noreferrer">re-write logging</a>, the url is being re-written correctly.</p>

<p>I have also hit the service directly from inside the pod, and that works as well.</p>

<pre><code>#service.yaml
kind: Service
apiVersion: v1
metadata:
  name: my-service
spec:
  ports:
  - name: https
    protocol: TCP
    port: 5000
    targetPort: https
  selector:
    app: my-app
  clusterIP: &lt;redacted&gt;
  type: ClusterIP
  sessionAffinity: None
</code></pre>

<p>What could be going wrong?</p>

<p><strong>EDIT</strong>: Disabling https all over still gives the same 400 error. However, if my app is expecting HTTPS requests, and nginx is sending HTTP requests, then the requests get to the app (but it can't processes them)</p>

<p>Nginx will silently fail with 400 if request headers are invalid (like special characters in it). You can debug that using tcpdump.</p>
