title: Kubernetes nginx Ingress redirect 302
body: <p>I have an nginx ingress controller and ingress resource for hazlecast running with path /hazlecast-mancenter mapped to hazlecast-mancenter in the backend. When I try to hit &quot;http://hostname/hazlecast-mancenter&quot; the page doesn't come up . When i check the logs in deployment of ingress controller i get the following logs</p>
  <pre><code>192.168.3.193 - - [10/Jun/2022:16:52:58 +0000] &quot;GET /favicon.ico HTTP/2.0&quot; 302 0 &quot;https://james.new-dev.com/hazelcast-mancenter/&quot; &quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537 
  </code></pre>
  <p>Not sure why it is redirecting it here.</p>
  <p>Below are the manifests for ingress</p>
  <pre><code>apiVersion: networking.k8s.io/v1
  kind: Ingress
  metadata:
    annotations:
      kubernetes.io/ingress.class: nginx
      meta.helm.sh/release-name: hazelcast
      meta.helm.sh/release-namespace: default
      nginx.ingress.kubernetes.io/add-base-url: &quot;true&quot;
      nginx.ingress.kubernetes.io/rewrite-target: /$1
    creationTimestamp: &quot;2022-06-10T14:18:37Z&quot;
    generation: 6
    labels:
      app.kubernetes.io/instance: hazelcast
      app.kubernetes.io/managed-by: Helm
      app.kubernetes.io/name: hazelcast-mancenter
      helm.sh/chart: hazelcast-5.4.1
    name: hazelcast-mancenter
    namespace: default
    resourceVersion: &quot;4041983&quot;
    uid: 36921da3-0757-47c1-9d88-1a87490393df
  spec:
    rules:
   - host: james.new-dev.com
      http:
        paths:
        - backend:
            service:
              name: hazelcast-mancenter
              port:
                number: 8080
          path: /hazelcast-mancenter
          pathType: Prefix
    tls:
   - secretName: new-dev-tls
  </code></pre>
  <p>Deployment</p>
  <pre><code>kubectl describe sts hazelcast-mancenter
  Name:               hazelcast-mancenter
  Namespace:          default
  CreationTimestamp:  Fri, 10 Jun 2022 14:18:37 +0000
  Selector:           app.kubernetes.io/instance=hazelcast,app.kubernetes.io/name=hazelcast-mancenter,role=mancenter
  Labels:             app.kubernetes.io/instance=hazelcast
                      app.kubernetes.io/managed-by=Helm
                      app.kubernetes.io/name=hazelcast-mancenter
                      helm.sh/chart=hazelcast-5.4.1
  Annotations:        meta.helm.sh/release-name: hazelcast
                      meta.helm.sh/release-namespace: default
  Replicas:           1 desired | 1 total
  Update Strategy:    RollingUpdate
    Partition:        0
  Pods Status:        1 Running / 0 Waiting / 0 Succeeded / 0 Failed
  Pod Template:
    Labels:           app.kubernetes.io/instance=hazelcast
                      app.kubernetes.io/managed-by=Helm
                      app.kubernetes.io/name=hazelcast-mancenter
                      helm.sh/chart=hazelcast-5.4.1
                      role=mancenter
    Service Account:  hazelcast
    Containers:
     hazelcast-mancenter:
      Image:      hazelcast/management-center:5.1.2
      Port:       8080/TCP
      Host Port:  0/TCP
      Liveness:   http-get http://:8081/health delay=30s timeout=5s period=10s #success=1 #failure=3
      Readiness:  tcp-socket :8080 delay=30s timeout=1s period=10s #success=1 #failure=3
      Environment:
        MC_INIT_CMD:  ./bin/mc-conf.sh cluster add --lenient=true -H /data -cc /config/hazelcast-client.yaml;
        JAVA_OPTS:     -Dhazelcast.mc.healthCheck.enable=true -DserviceName=hazelcast -Dnamespace=default -Dhazelcast.mc.tls.enabled=false
      Mounts:
        /config from config (rw)
        /data from mancenter-storage (rw)
    Volumes:
     config:
      Type:      ConfigMap (a volume populated by a ConfigMap)
      Name:      hazelcast-mancenter-configuration
      Optional:  false
     mancenter-storage:
      Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
      Medium:
      SizeLimit:  &lt;unset&gt;
  Volume Claims:
    Name:          mancenter-storage
    StorageClass:
    Labels:        app.kubernetes.io/instance=hazelcast
                   app.kubernetes.io/managed-by=Helm
                   app.kubernetes.io/name=hazelcast-mancenter
                   helm.sh/chart=hazelcast-5.4.1
    Annotations:   &lt;none&gt;
    Capacity:      8Gi
    Access Modes:  [ReadWriteOnce]
  Events:          &lt;none&gt;
  </code></pre>
  <p>Service</p>
  <pre><code>kubectl describe svc hazelcast-mancenter
  Name:              hazelcast-mancenter
  Namespace:         default
  Labels:            app.kubernetes.io/instance=hazelcast
                     app.kubernetes.io/managed-by=Helm
                     app.kubernetes.io/name=hazelcast-mancenter
                     helm.sh/chart=hazelcast-5.4.1
  Annotations:       meta.helm.sh/release-name: hazelcast
                     meta.helm.sh/release-namespace: default
  Selector:          app.kubernetes.io/instance=hazelcast,app.kubernetes.io/name=hazelcast-mancenter,role=mancenter
  Type:              ClusterIP
  IP Family Policy:  SingleStack
  IP Families:       IPv4
  IP:                10.100.125.152
  IPs:               10.100.125.152
  Port:              http  8080/TCP
  TargetPort:        mancenter/TCP
  Endpoints:         192.168.1.190:8080
  Port:              https  443/TCP
  TargetPort:        mancenter/TCP
  Endpoints:         192.168.1.190:8080
  Session Affinity:  None
  Events:            &lt;none&gt;
  </code></pre>
  <p>I have mapped the ingress port with svc and target port, not sure why the redirect 302 code is thrown</p>
  <p>When i do a inspect of the url when hit i get 302 redirected , below are some snapshots that i am pasting</p>
  <p><a href="https://i.stack.imgur.com/4iI7P.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4iI7P.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.stack.imgur.com/ibfWq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ibfWq.png" alt="enter image description here" /></a></p>