<p>I am using ingress-nginx for my kubernetes cluster with AWS tls certificate .</p>
<p>Both the <strong>frontend</strong> and <strong>backend</strong> services are running inside the cluster.</p>
<p>I am <strong>able to view the frontend</strong> but when it interacts with backend it throws the error :</p>
<pre><code>ERR_TOO_MANY_REDIRECTS
</code></pre>
<blockquote>
<p><strong>Ingress nginx</strong></p>
</blockquote>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: ingress-service
  annotations:
    nginx.ingress.kubernetes.io/default-backend: ingress-nginx-controller
    nginx.ingress.kubernetes.io/use-regex: &quot;true&quot;
    nginx.ingress.kubernetes.io/configuration-snippet: |
      add_header Access-Control-Allow-Methods &quot;POST, GET, OPTIONS&quot;;
      add_header Access-Control-Allow-Credentials true;
    nginx.ingress.kubernetes.io/enable-cors: &quot;true&quot;
    nginx.ingress.kubernetes.io/cors-allow-methods: &quot;PUT, GET, POST, OPTIONS&quot;
    nginx.ingress.kubernetes.io/from-to-www-redirect: &quot;true&quot;
    nginx.ingress.kubernetes.io/ssl-redirect: &quot;false&quot;
spec:
  tls:
  - hosts:
      - example.com
      - www.example.com
  rules:
    - host: www.example.com
      http:
        paths:
          - path: /api/upload/?(.*)
            backend:
              serviceName: aws-srv
              servicePort: 3000

</code></pre>
<blockquote>
<p><strong>Ingress nginx service</strong></p>
</blockquote>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Service
metadata:
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-type: nlb
    service.beta.kubernetes.io/aws-load-balancer-ssl-ports: &quot;https&quot;
    service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: &quot;*&quot;
    service.beta.kubernetes.io/aws-load-balancer-ssl-cert: &quot;arn:aws:acm:ap-south-1XXXXX&quot;
    service.beta.kubernetes.io/aws-load-balancer-backend-protocol: &quot;http&quot;
  labels:
    helm.sh/chart: ingress-nginx-2.11.1
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/instance: ingress-nginx
    app.kubernetes.io/version: 0.34.1
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/component: controller
  name: ingress-nginx-controller
  namespace: ingress-nginx
spec:
  type: LoadBalancer
  externalTrafficPolicy: Local
  ports:
    - name: http
      port: 80
      protocol: TCP
      targetPort: http
    - name: https
      port: 443
      protocol: TCP
      targetPort: http
  selector:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/instance: ingress-nginx
    app.kubernetes.io/component: controller

</code></pre>
<p>I am stuck here and unable to take this to production, thanks in advance!</p>

Karan Kumar
<p>Which URL did you define in backend ? if it's <a href="http://www.example.com" rel="nofollow noreferrer">www.example.com</a>, then remove <code>- example.com</code> line.</p>
<p>I think you should remove aline in this:</p>
<pre><code>spec:
  tls:
  - hosts:
      - example.com
      - www.example.com
</code></pre>
<p>Remove : <code>- example.com</code> then check again.</p>
<p>OR you keep both hosts:
but reconfigure this :     <code>nginx.ingress.kubernetes.io/from-to-www-redirect: &quot;false&quot;</code></p>
