Skip to content

bug: Only the first of multiple wildcard domain certificates works #2084

@incubator4

Description

@incubator4

Current Behavior

I use cert-manager to create a multi wildcard domain cert like this:

apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: apisix-default-cert
  namespace: <namespace>
spec:
  dnsNames:
    - '*.staging.domain.com'
    - '*.prod.domain.com'
  issuerRef:
    kind: ClusterIssuer
    name: cloudflare
  secretName: apisix-default-cert

Then I would get a secret apisix-default-cert with two wildcard domains. And use cloud native way to inject secret to apisix by apisix ingress controllor TLS crd.

apiVersion: apisix.apache.org/v2
kind: ApisixTls
metadata:
  name: apisix-tls
  namespace: <namespace>
spec:
  hosts:
    - "*.staging.domain.com"
    - "*.prod.domain.com"
  secret:
    name: apisix-default-cert
    namespace: <some ns>

After this, I can see tls have been applied in apisix by call admin api

there is some reponse.

{"snis": ["*.staging.domain.com","*.prod.domain.com"]}

Then I try some host by curl but got error.

staging

this return error msg show ssl worked.

$ curl https://test.staging.domain.com
{"error_msg":"404 Route Not Found"}

prod

this return ssl error.

$ curl https://test.prod.domain.com
curl: (35) LibreSSL/3.3.6: error:1404B438:SSL routines:ST_CONNECT:tlsv1 alert internal error

Expected Behavior

I thought both wildcard domain should take effect, instead of the first.
If multiple wildcard domain are not supported, neither apisix nor apisix-ingress-controller reported any errors. It might be denied at some stage of apisix or apisix-ingress-controller ?

Error Logs

No response

Steps to Reproduce

  1. Create a multi wildcard domain cert.
  2. Apply cert to apisix
  3. Use other than the first domain name to access apisix

Environment

  • APISIX version (run apisix version): 3.6.0
  • APISIX Docker version: 3.6.0-debian
  • OpenResty / Nginx version (run openresty -V or nginx -V): openresty/1.21.4.2
  • APISIX Ingress Controller version: 1.7.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions