I'm trying to access my website by pointing to domain.coom instead of www.domain.com using the base domain instead of subdomain.
Whenever I use sub-domain it works fine, but when I switch to base domain it points to default backend.
Ingress with subdomain:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: web-ingress
namespace: th3-website
labels:
app: web
environment: prod
spec:
rules:
- host: www.domain.com
http:
paths:
- backend:
serviceName: web-service
servicePort: 80
and result with curl:
HTTP/1.1 302 Found
Content-Type: text/html; charset=UTF-8
Date: Tue, 26 Nov 2019 21:34:24 GMT
Location: /talent
Server: openresty/1.15.8.2
Set-Cookie: lang=en; expires=Sun, 23-Jul-9116 21:34:24 GMT; path=/; domain=.domain.com
Set-Cookie: country=my; expires=Sun, 23-Jul-9116 21:34:24 GMT; path=/; domain=.domain.com
X-Powered-By: PHP/7.2.25
Connection: keep-alive
But when I switch to base domain:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: web-ingress
namespace: th3-website
labels:
app: web
environment: prod
spec:
rules:
- host: domain.com
http:
paths:
- backend:
serviceName: web-service
servicePort: 80
result with curl (curl -I domain.com
):
TTP/1.1 200 OK
accept-ranges: bytes
Content-Length: 338
Content-Type: text/html
Date: Tue, 26 Nov 2019 21:35:46 GMT
etag: "5cc81b56-152"
last-modified: Tue, 30 Apr 2019 09:54:30 GMT
Server: openresty/1.15.8.2
Vary: Accept-Encoding
x-envoy-decorator-operation: maintenance.default.svc.cluster.local:80/*
x-envoy-upstream-service-time: 0
Connection: keep-alive
result with curl (curl -I domain.com/talent
):
HTTP/1.1 404 Not Found
Content-Length: 154
Content-Type: text/html
Date: Tue, 26 Nov 2019 21:36:04 GMT
Server: openresty/1.15.8.2
x-envoy-decorator-operation: maintenance.default.svc.cluster.local:80/*
x-envoy-upstream-service-time: 0
Connection: keep-alive
How can I use my base domain instead of sub domain alongside with some other services that uses sub domain?
Trying to find a way but to no avail, any help is appreciated! here is my ingress controller log if it might help:
I1126 21:40:43.271131 6 controller.go:134] Configuration changes detected, backend reload required.
I1126 21:40:43.458881 6 controller.go:150] Backend successfully reloaded.
xxx.xxx.xxx.xxx - - [26/Nov/2019:21:40:58 +0000] "HEAD /talent HTTP/1.1" 404 0 "-" "curl/7.64.1" 188 0.004 [default-maintenance-80] [] xxx.xxx.xxx:80 0 0.004 404 xxx
xxx.xxx.xxx.xxx - - [26/Nov/2019:21:41:51 +0000] "HEAD / HTTP/1.1" 200 0 "-" "curl/7.64.1" 182 0.004 [default-maintenance-80] [] xxx.xxx.xxx.xxx:80 0 0.004 200 xxx