title: 404 Not Found Ingress-nginx and 400 Bad Request The plain HTTP request was sent to HTTPS port nginx
body: <pre><code>Host OS: Windows 10.
  Docker version 19.03.13, build 4484c46d9d (WSL 2 Backend)
  kubectl version
  Client Version: version.Info{Major:&quot;1&quot;, Minor:&quot;19&quot;, GitVersion:&quot;v1.19.3&quot;, GitCommit:&quot;1e11e4a2108024935ecfcb2912226cedeafd99df&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2020-10-14T12:50:19Z&quot;, GoVersion:&quot;go1.15.2&quot;, Compiler:&quot;gc&quot;, Platform:&quot;windows/amd64&quot;}
  Server Version: version.Info{Major:&quot;1&quot;, Minor:&quot;19&quot;, GitVersion:&quot;v1.19.3&quot;, GitCommit:&quot;1e11e4a2108024935ecfcb2912226cedeafd99df&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2020-10-14T12:41:49Z&quot;, GoVersion:&quot;go1.15.2&quot;, Compiler:&quot;gc&quot;, Platform:&quot;linux/amd64&quot;}
  </code></pre>
  <p>I ran this command to install kubernetes ingress-nginx:</p>
  <p><code>kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.41.2/deploy/static/provider/cloud/deploy.yaml</code></p>
  <p><a href="https://github.com/DVGY/basic-docker-kuber" rel="nofollow noreferrer">https://github.com/DVGY/basic-docker-kuber</a></p>
  <p>Running skaffold dev cmd</p>
  <pre><code>skaffold dev
  Listing files to watch...
   - dvgy/auth
  Generating tags...
   - dvgy/auth -&gt; dvgy/auth:e63ddf4-dirty
  Checking cache...
   - dvgy/auth: Found. Tagging
  Tags used in deployment:
   - dvgy/auth -&gt; dvgy/auth:9029b37d0e6a3bf1b5cc8cb4c5ce596d61e4ef5869bc0e34decb13586494cd93
  Starting deploy...
   - deployment.apps/auth-depl configured
   - service/auth-srv configured
   - Warning: extensions/v1beta1 Ingress is deprecated in v1.14+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress
   - ingress.extensions/ingress-service configured
  Waiting for deployments to stabilize...
   - deployment/auth-depl: creating container auth
      - pod/auth-depl-6d7c7594b8-t2859: creating container auth
   - deployment/auth-depl is ready.
  Deployments stabilized in 7.5991142s
  Press Ctrl+C to exit
  Watching for changes...
  [auth]
  [auth] &gt; shopme@1.0.0 start
  [auth] &gt; ts-node-dev src/index.ts
  [auth]
  [auth] [INFO] 12:52:04 ts-node-dev ver. 1.0.0 (using ts-node ver. 9.1.0, typescript ver. 4.1.2)
  [auth] Listeninig on port 3000!!
  </code></pre>
  <p>I have made change to my hosts file as 127.0.0.1 ticketing.dev</p>
  <p><strong>Going to route:</strong> <code>https://ticketing.dev/api/users/currentuser</code> <strong>give me error 404 Not Found nginx and</strong>  <strong>curl to different port give following error</strong></p>
  <pre><code>curl http://127.0.0.1:443/api/users/currentuser
  curl : 400 Bad Request
  The plain HTTP request was sent to HTTPS port
  nginx
  
  
  # All YAML Files are here
  
  #ingress-srv.yaml
  
  apiVersion: extensions/v1beta1
  # apiVersion: networking.k8s.io/v1
  kind: Ingress
  metadata:
    name: ingress-service
    annotations:
      kubernetes.io/ingress.class: ngnix
      ngnix.ingress.kubernetes.io/use-regex: &quot;true&quot;
  spec:
    rules:
      - host: ticketing.dev
        http:
          paths:
            - path: /api/users/?(.*)
              backend:
                serviceName: auth-srv
                servicePort: 3000
  
  # auth-depl.yaml
  
  apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: auth-depl
  spec:
    replicas: 1 # tells how many pods to create
    selector: # tells deployment how to find the pods it's going to create
      matchLabels:
        app: auth
    template: # how to create the pods
      metadata:
        labels:
          app: auth
      spec:
        containers:
          - name: auth
            image: dvgy/auth
  ---
  apiVersion: v1
  kind: Service
  metadata:
    name: auth-srv
  spec:
    selector:
      app: auth
    ports:
      - name: auth
        protocol: TCP
        port: 3000
        targetPort: 3000
  
  #scaffold.yaml
  apiVersion: skaffold/v2alpha3
  kind: Config
  deploy:
    kubectl:
      manifests:
        - ./infra/k8s/*
  build:
    local:
      push: false
    artifacts:
      - image: dvgy/auth
        context: auth
        docker:
          dockerfile: Dockerfile
        sync:
          manual:
            - src: &quot;src/**/*.ts&quot;
              dest: .
  </code></pre>
  <p>kubectl get svc --all-namespaces</p>
  <pre><code>NAMESPACE       NAME                                 TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
  default         auth-srv                             ClusterIP      10.108.121.124   &lt;none&gt;        3000/TCP                     6d2h
  default         kubernetes                           ClusterIP      10.96.0.1        &lt;none&gt;        443/TCP                      6d3h
  ingress-nginx   ingress-nginx-controller             LoadBalancer   10.110.140.13    localhost     80:31147/TCP,443:32303/TCP   6d2h
  ingress-nginx   ingress-nginx-controller-admission   ClusterIP      10.104.133.178   &lt;none&gt;        443/TCP                      6d2h
  kube-system     kube-dns                             ClusterIP      10.96.0.10       &lt;none&gt;        53/UDP,53/TCP,9153/TCP       6d3h
  </code></pre>
  <p>kubectl get pods -n ingress-nginx</p>
  <pre><code>NAME                                       READY   STATUS      RESTARTS   AGE
  ingress-nginx-admission-create-fghgd       0/1     Completed   0          6d2h
  ingress-nginx-admission-patch-lr2sr        0/1     Completed   0          6d2h
  ingress-nginx-controller-c4f944d4d-jb4pb   1/1     Running     7          6d2h
  </code></pre>
  <p>kubectl logs -n ingress-nginx ingress-nginx-controller-c4f944d4d-jb4pb</p>
  <pre><code>-------------------------------------------------------------------------------
  NGINX Ingress controller
    Release:       v0.41.2
    Build:         d8a93551e6e5798fc4af3eb910cef62ecddc8938
    Repository:    https://github.com/kubernetes/ingress-nginx
    nginx version: nginx/1.19.4
  
  -------------------------------------------------------------------------------
  
  I1211 15:15:29.155918       7 flags.go:205] &quot;Watching for Ingress&quot; class=&quot;nginx&quot;
  W1211 15:15:29.156218       7 flags.go:210] Ingresses with an empty class will also be processed by this Ingress controller
  W1211 15:15:29.171113       7 client_config.go:608] Neither --kubeconfig nor --master was specified.  Using the inClusterConfig.  This might not work.
  I1211 15:15:29.352539       7 main.go:241] &quot;Creating API client&quot; host=&quot;https://10.96.0.1:443&quot;
  W1211 15:15:52.326223       7 main.go:282] Initial connection to the Kubernetes API server was retried 1 times.
  I1211 15:15:52.326410       7 main.go:285] &quot;Running in Kubernetes cluster&quot; major=&quot;1&quot; minor=&quot;19&quot; git=&quot;v1.19.3&quot; state=&quot;clean&quot; commit=&quot;1e11e4a2108024935ecfcb2912226cedeafd99df&quot; platform=&quot;linux/amd64&quot;
  I1211 15:15:53.297134       7 main.go:105] &quot;SSL fake certificate created&quot; file=&quot;/etc/ingress-controller/ssl/default-fake-certificate.pem&quot;
  I1211 15:15:53.301436       7 main.go:115] &quot;Enabling new Ingress features available since Kubernetes v1.18&quot;
  W1211 15:15:53.312577       7 main.go:127] No IngressClass resource with name nginx found. Only annotation will be used.
  I1211 15:15:53.525197       7 ssl.go:528] &quot;loading tls certificate&quot; path=&quot;/usr/local/certificates/cert&quot; key=&quot;/usr/local/certificates/key&quot;
  I1211 15:15:53.762574       7 nginx.go:249] &quot;Starting NGINX Ingress controller&quot;
  I1211 15:15:53.832694       7 event.go:282] Event(v1.ObjectReference{Kind:&quot;ConfigMap&quot;, Namespace:&quot;ingress-nginx&quot;, Name:&quot;ingress-nginx-controller&quot;, UID:&quot;3a9fee6c-798c-4d54-bd50-9ca5ebadaf50&quot;, APIVersion:&quot;v1&quot;, ResourceVersion:&quot;1906&quot;, FieldPath:&quot;&quot;}): type: 'Normal' reason: 'CREATE' ConfigMap ingress-nginx/ingress-nginx-controller    
  I1211 15:15:55.138894       7 store.go:352] &quot;Ignoring ingress&quot; ingress=&quot;default/ingress-service&quot; kubernetes.io/ingress.class=&quot;&quot; ingressClassName=&quot;&quot;
  I1211 15:15:55.164305       7 nginx.go:291] &quot;Starting NGINX process&quot;
  I1211 15:15:55.164376       7 leaderelection.go:243] attempting to acquire leader lease  ingress-nginx/ingress-controller-leader-nginx...
  I1211 15:15:55.165971       7 nginx.go:311] &quot;Starting validation webhook&quot; address=&quot;:8443&quot; certPath=&quot;/usr/local/certificates/cert&quot; keyPath=&quot;/usr/local/certificates/key&quot;
  I1211 15:15:55.168921       7 controller.go:144] &quot;Configuration changes detected, backend reload required&quot;
  I1211 15:15:55.235125       7 leaderelection.go:253] successfully acquired lease ingress-nginx/ingress-controller-leader-nginx
  I1211 15:15:55.235473       7 status.go:84] &quot;New leader elected&quot; identity=&quot;ingress-nginx-controller-c4f944d4d-jb4pb&quot;
  I1211 15:15:56.955152       7 controller.go:161] &quot;Backend successfully reloaded&quot;
  I1211 15:15:56.955507       7 controller.go:172] &quot;Initial sync, sleeping for 1 second&quot;
  I1211 15:15:56.955751       7 event.go:282] Event(v1.ObjectReference{Kind:&quot;Pod&quot;, Namespace:&quot;ingress-nginx&quot;, Name:&quot;ingress-nginx-controller-c4f944d4d-jb4pb&quot;, UID:&quot;27e3172f-31bb-4c99-91a5-7276f2323473&quot;, APIVersion:&quot;v1&quot;, ResourceVersion:&quot;64697&quot;, FieldPath:&quot;&quot;}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
  W1211 15:15:57.958746       7 controller.go:190] Dynamic reconfiguration failed: Post &quot;http://127.0.0.1:10246/configuration/backends&quot;: dial tcp 127.0.0.1:10246: connect: connection refused
  E1211 15:15:57.958862       7 controller.go:194] Unexpected failure reconfiguring NGINX:
  Post &quot;http://127.0.0.1:10246/configuration/backends&quot;: dial tcp 127.0.0.1:10246: connect: connection refused
  E1211 15:15:57.958971       7 queue.go:130] &quot;requeuing&quot; err=&quot;Post \&quot;http://127.0.0.1:10246/configuration/backends\&quot;: dial tcp 127.0.0.1:10246: connect: connection refused&quot; key=&quot;initial-sync&quot;
  I1211 15:15:58.500927       7 controller.go:144] &quot;Configuration changes detected, backend reload required&quot;
  I1211 15:15:58.849780       7 controller.go:161] &quot;Backend successfully reloaded&quot;
  I1211 15:15:58.850465       7 controller.go:172] &quot;Initial sync, sleeping for 1 second&quot;
  I1211 15:15:58.851686       7 event.go:282] Event(v1.ObjectReference{Kind:&quot;Pod&quot;, Namespace:&quot;ingress-nginx&quot;, Name:&quot;ingress-nginx-controller-c4f944d4d-jb4pb&quot;, UID:&quot;27e3172f-31bb-4c99-91a5-7276f2323473&quot;, APIVersion:&quot;v1&quot;, ResourceVersion:&quot;64697&quot;, FieldPath:&quot;&quot;}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration
  W1211 15:23:30.757190       7 controller.go:216] ignoring ingress ingress-service in default based on annotation kubernetes.io/ingress.class
  I1211 15:23:30.757399       7 main.go:112] &quot;successfully validated configuration, accepting&quot; ingress=&quot;ingress-service/default&quot;
  192.168.65.3 - - [11/Dec/2020:15:34:03 +0000] &quot;GET /api/users/currentuser HTTP/1.1&quot; 400 650 &quot;-&quot; &quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, 
  like Gecko) Chrome/87.0.4280.88 Safari/537.36&quot; 550 0.000 [] [] - - - - 6589292b718e14361d4f46f913262ba1
  192.168.65.3 - - [11/Dec/2020:15:34:04 +0000] &quot;GET /favicon.ico HTTP/1.1&quot; 400 650 &quot;http://127.0.0.1:443/api/users/currentuser&quot; &quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36&quot; 461 0.000 [] [] - - - - ce351cc06eb3e5eb5a58a5d288491468
  192.168.65.3 - - [11/Dec/2020:15:48:09 +0000] &quot;GET /api/users/currentuser HTTP/1.1&quot; 400 650 &quot;-&quot; &quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, 
  like Gecko) Chrome/87.0.4280.88 Safari/537.36&quot; 576 0.000 [] [] - - - - 204ee27fe4fbd78d3846754f19572e67
  192.168.65.3 - - [11/Dec/2020:15:48:10 +0000] &quot;GET /favicon.ico HTTP/1.1&quot; 400 650 &quot;http://127.0.0.1:443/api/users/currentuser&quot; &quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36&quot; 461 0.000 [] [] - - - - be6d5396e3b87e8861b44be7dc6b69a1
  W1211 16:00:18.493662       7 controller.go:216] ignoring ingress rewrite in default based on annotation kubernetes.io/ingress.class
  I1211 16:00:18.494592       7 main.go:112] &quot;successfully validated configuration, accepting&quot; ingress=&quot;rewrite/default&quot;
  I1211 16:00:18.556281       7 store.go:352] &quot;Ignoring ingress&quot; ingress=&quot;default/rewrite&quot; kubernetes.io/ingress.class=&quot;&quot; ingressClassName=&quot;&quot;
  W1211 16:02:34.780388       7 controller.go:216] ignoring ingress ingress-service in default based on annotation kubernetes.io/ingress.class
  I1211 16:02:34.780444       7 main.go:112] &quot;successfully validated configuration, accepting&quot; ingress=&quot;ingress-service/default&quot;
  192.168.65.3 - - [11/Dec/2020:16:06:36 +0000] &quot;GET /api/users/currentuser HTTP/1.1&quot; 400 248 &quot;-&quot; &quot;Mozilla/5.0 (Windows NT; Windows NT 10.0; en-US) WindowsPowerShell/5.1.19041.610&quot; 178 0.000 [] [] - - - - e1d7de4a83d59b24f3f657584891d508
  PS C:\Users\Gaurav Yadav\Documents\gitLocal\node with react microservice\ShopMe&gt; 
  </code></pre>