kubernetesnginxcert-manager

Accessing API over url gives 404 error, accesing it over the IP works fine


I added an SSL certificate with cert manager to my cluster, and now I get an 404 error when accessing it over the URL. When I access it with the IP, it works fine. I am using nginx.

Ingress-nginx-controller pod log when accessing over IP:

[08/Feb/2024:14:50:38 +0000] "GET / HTTP/1.1" 200 25 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36" 474 0.003 [btcapi-btcapi-service-80] [] 10.244.0.66:80 25 0.004 200 b8ad8a9e72f22a3cf7a72b602f5226c8

when accessing over url:

[08/Feb/2024:14:50:36 +0000] "GET / HTTP/1.1" 404 548 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36 (scanner.ducks.party)" 212 0.000 [upstream-default-backend] [] 127.0.0.1:8181 548 0.001 404 681ce509b41db827657e2e45bda810fd

Let me know if you need any else information. Do not really know what to share.


Solution

  • I solved this, in my ingress I had this configuration error Old ingress

      rules:
        - host: gtp.lunarlabs.me
        - http:
            paths:
    

    you need to set a host but it did not get the host because of the "-" before the http so I removed it and now it works fine