Multiple certificates in same Gateway HTTPs Listener #5647
Replies: 2 comments 3 replies
|
Hi @pvillaverde, are you able to share the nginx conf that gets generated for the HTTPS listener/routes? |
|
Technically your workaround is the correct way to define what you intend, per the Gateway API spec. One other option (if it's feasible) is to use a wildcard cert that can cover the different domains. Then you can keep the single Listener. The spec states:
and
This means that the certs that are attached to a Listener are all available for that hostname (which in your case results in the empty, default server block; meaning all hostnames), but aren't mapped individually to each hostname defined in each HTTPRoute that is attached to that Listener. Our controller does not inspect the certs directly to determine each cert's SNI so we can map them to each HTTPRoute hostname attached to the empty Listener. When multiple certs are defined in the nginx config in a single server block, nginx negotiates the best cipher out of those certs, but does not pick the right one by SNI. SNI-based virtual server selection happens by matching the Also, since there's a limit on the number of Listeners in a Gateway, it may be better to use a ListenerSet if you find yourself having to define many. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hey there,
I'm migrating from Ingress Nginx to Nginx Gateway Fabric and I've run into a issue that might be my lack of understanding. I'm running version 2.6.7 and I have configured a gateway with 2 listeners (http and https).
For the HTTP I have configured a single HTTPRoute that redirects all traffic to https. Then my idea was to have HTTPRoutes for each different site using the https-listener, i.e.
However, it seems that the gateway is not able to serve the certificate according to the SNI and is always returning the last certificate (domain3). I've read the documentation and haven't found exactly how am I supposed to do it. In fact all examples I see set the hostname in the listener, which doesn't make sense for me, unless the expected is to have a listener for each hostname (or domain).
Edited:
I've tried adding several listeners on the same ports but its quite messy and it feels overkillingly repeating, specially if you want to serve both root and sub domains, i.e.
So this makes me think there has to be a better way. And what is the point of specifying multiple certificateRefs in the same listener if its just going to pick the last one instead of choose based on the SNI? It it possible that it got implemented here #3645 but it doesnt work when it has to decide which cert to serve the client request?
All reactions