Reputation: 7507
I am struggling to get my nginx ingress (on AWS EKS) working with path rules and TLS.
The ingress is from here
A snippet from the Ingress looks like:
spec:
tls:
- hosts:
- example.com
secretName: ingress-tls
rules:
- host: example.com
- http:
paths:
- path: /api
pathType: Prefix
backend:
service:
name: api-service
port:
number: 443
This ingress creates the AWS network load balancer, with a URL like
https://xyz.elb.us-west-1.amazonaws.com/
I am updating the
ingress-tls
secret with a certificate using
cert-manager
.
When I access the ingress using the NLB URL
https://xyz.elb.us-west-1.amazonaws.com/api
, I get
api-service
as expected)When I access the ingress using the correct domain e.g.
https://example.com/api
which is what I want to do, I get:
404
, it doesn't respect my path rules, and goes to
upstream-default-backend
instead.example.com
that
cert-manager
configured.I tried removing the
host: example.com
from the
rules:
, which gives me:
example.com
, I guess since the
host
is missing from the rules, though not sure of the exact reason.Can someone please help me get
I’m at a loss here.
Upvotes: 0
Views: 176
Reputation: 7507
After staring at this for several more hours, and digging through the nasty chunk of lua that is the
nginx.conf
for this, I found it! Maybe someday someone will have this problem, and might find this useful.
The problem was:
rules:
- host: example.com
- http:
This is defining (I think) a
host
with no forwarding rules, then then some
http
forwarding rules without a host. What I had intended was obviously that the forwarding rules would be for the host.
And that would be:
rules:
- host: example.com
http:
I have to say that I'm now even less of a fan of YAML than I was previously, if that's even possible.
Upvotes: 1