Proxy respond with 404 Not found

Hi,
I have deployed kong 1.3 in kubernetes using helm chart. My ingress yml is -

  • apiVersion: extensions/v1beta1
    kind: Ingress
    metadata:
    annotations:
    nginx.ingress.kubernetes.io/backend-protocol: HTTPS
    nginx.ingress.kubernetes.io/rewrite-target: /
    creationTimestamp: 2019-11-19T22:40:37Z
    generation: 5
    labels:
    app: kong
    chart: kong-0.27.0
    heritage: Tiller
    release: base-kong
    name: base-kong-kong-proxy
    namespace: base-kong
    resourceVersion: “48755579”
    selfLink: /apis/extensions/v1beta1/namespaces/base-kong/ingresses/base-kong-kong-proxy
    uid: 9b1cc366-0b1d-11ea-9266-864d78f39cfe
    spec:
    rules:
    • host:
      http:
      paths:
      • backend:
        serviceName: base-kong-kong-proxy
        servicePort: 443
        path: /kongproxy
        status:
        loadBalancer:
        ingress:
      • {}
        kind: List
        metadata:
        resourceVersion: “”
        selfLink: “”

Now when I am trying to access kong proxy using : https://some-host/kongproxy

I am getting 404 Not found,
{
“message”: “no Route matched with those values”
}

Though I am able to access admin. Please help me. I am not sure what I am doing wrong here.

@hbagdi Hi Harry, I need your help on this. Please help me sort this problem. I am very new to kong. I confirgure services and routes and when I access routes through kong proxy, that also returns 404

Hi,

i can’t see the host value set in your yaml, are you including "some-host?

Hi @abenitovsc
Thanks for your reply. yes host is there … i just deleted here as its company info

Are you using Nginx or Kong as your Ingress?
You only need Kong and don’t need Nginx-ingress.

@hbagdi I have deployed kong using helm in AKS (azure kubernetes service) and accessing kong through ingess rules. Above is my ingress yaml. Currently all backend are accessed through ingress-nginx but once Kong begins working, all backend API will be accessed through Kong proxy. I am able to access Kong Admin but not able access any configured services/routes using proxy.

Since you are getting 404, it means that Nginx is correctly sending request to Kong. Now you need to configure Kong to proxy the request to a service.

@hbagdi Please see below

`

  1. curl -i -X POST “https://some-url/kongadmin/services/” -d ‘name=http-bin’ -d ‘url=https://httpbin.org’

HTTP/2 201
server: openresty/1.15.8.2
date: Fri, 06 Dec 2019 22:47:43 GMT
content-type: application/json; charset=utf-8
content-length: 291
strict-transport-security: max-age=15724800; includeSubDomains
access-control-allow-origin: *

{“host”:“httpbin.org”,“created_at”:1575672463,“connect_timeout”:60000,“id”:“6b6c7834-9763-4c6e-b00d-255e9edfb7a1”,“protocol”:“https”,“name”:“http-bin”,“read_timeout”:60000,“port”:443,“path”:null,“updated_at”:1575672463,“retries”:5,“write_timeout”:60000,“tags”:null,“client_certificate”:null}

  1. curl -i -X POST “https://some-url/kongadmin/routes/” -d ‘hosts[]=httpbin.org’ -d ‘paths[]=/get’ -d ‘service.id=6b6c7834-9763-4c6e-b00d-255e9edfb7a1’

HTTP/2 201
server: openresty/1.15.8.2
date: Fri, 06 Dec 2019 22:51:14 GMT
content-type: application/json; charset=utf-8
content-length: 413
strict-transport-security: max-age=15724800; includeSubDomains
access-control-allow-origin: *

{“id”:“d076c9c0-261e-4b1b-8a4e-a61f462c0042”,“tags”:null,“updated_at”:1575672674,“destinations”:null,“headers”:null,“protocols”:[“http”,“https”],“created_at”:1575672674,“snis”:null,“service”:{“id”:“6b6c7834-9763-4c6e-b00d-255e9edfb7a1”},“name”:null,“preserve_host”:false,“regex_priority”:0,“strip_path”:true,“sources”:null,“paths”:["/get"],“https_redirect_status_code”:426,“hosts”:[“httpbin.org”],“methods”:null}

  1. curl -X GET “https://some-url/kongproxy” -H “host: httpbin.org

default backend - 404
`

I am still getting 404.

Could you please see if I am doing anything wrong here

@hbagdi Hi harry, could you please have a look at logs I sent and guide me further. One thing I specify is at the moment I have “nginx-ingress” and not “kong-ingress” installed.

This is what happens when you are using two proxies to route requests.

Although you’ve configured a route in Kong to route traffic for the host httpbin and path /get, the request actually never reaches Kong.

The nginx in front of Kong doesn’t know how to route traffic for host httpbin.org and hence routes it to it’s default backend instead to Kong.

@hbagdi Hi harry, What’s the solution for this? I am not using two proxy. Only nginx ingress is present at the moment.

Kong is also a proxy like Nginx.

What you need is to also setup a rule in Nginx to route all traffic to Kong.

Again, the solution here is to use only one proxy – either Kong or Nginx. Using both will only lead to more problems for you.

Aah okay. I will use kong ingress then will try and let you know. Many thanks! I will give you feedback by tomorrow

@hbagdi hi Harry, nginx is routing traffic to kong. See the kong logs -

10.244.2.59 - - [10/Dec/2019:14:39:00 +0000] “GET /health HTTP/1.1” 404 48 “-” “curl/7.61.1”
10.244.2.59 - - [10/Dec/2019:14:42:02 +0000] “GET /get HTTP/1.1” 404 48 “-” “curl/7.61.1”

But still I am getting 404. I am not able to understand what is causing this failed?

Solved! Thanks @hbagdi for your help. Its working now


© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ