Report this

What is the reason for this report?

How to I support both www.abc.com and abc.com?

Posted on November 25, 2019

Hi, I recently set up my kubernetes with ingress. I am able to access my REST through www.abc.com/api for example, however, if I try to access it via abc.com/api or abc.com/ doesn’t seem to reach the server (404).

How can I enable my server to be reachable by both www.abc.com and abc.com?

Below is my ingress definition


apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: web-ingress
  annotations:
    kubernetes.io/ingress.class:  'nginx'
    nginx.ingress.kubernetes.io/from-to-www-redirect: "True"
spec:
  rules:
  - host: www.abc.com
    http:
      paths:
      - path: /
        backend:
          serviceName: abc-web-service
          servicePort: 80
      - path: /api
        backend:
          serviceName: abc-rest-service
          servicePort: 80

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.