Question
How to I support both www.abc.com and abc.com?
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
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×