404 for existing service/route

I cannot figure out what I am doing wrong, I am getting 404, can someone help me pls?
Kong version: 2.2.1
here is my service

{
            "host": "authentication-service.hostelworld.com.docker.test.hostelworld.com",
            "id": "7c392680-4133-4f3e-933e-dabf8fca7b52",
            "protocol": "http",
            "read_timeout": 60000,
            "tls_verify_depth": null,
            "port": 80,
            "updated_at": 1610476434,
            "ca_certificates": null,
            "created_at": 1610475201,
            "connect_timeout": 60000,
            "write_timeout": 60000,
            "name": "auth",
            "retries": 5,
            "path": "/authentication",
            "tls_verify": null,
            "tags": [
                "testing"
            ],
            "client_certificate": null
        }

and here is the route for the service above

{
    "next": null,
    "data": [
        {
            "strip_path": true,
            "path_handling": "v1",
            "paths": null,
            "destinations": null,
            "headers": null,
            "protocols": [
                "http",
                "https"
            ],
            "tags": [
                "testing"
            ],
            "created_at": 1610475310,
            "request_buffering": true,
            "service": {
                "id": "7c392680-4133-4f3e-933e-dabf8fca7b52"
            },
            "name": "auth",
            "updated_at": 1610476202,
            "methods": [
                "POST"
            ],
            "preserve_host": false,
            "regex_priority": 0,
            "response_buffering": true,
            "sources": null,
            "id": "279741de-2a29-4f34-9874-887265c7a8a1",
            "https_redirect_status_code": 426,
            "snis": null,
            "hosts": null
        }
    ]
}

and the request

curl --location --request POST 'http://localhost:8000/v1/authentication/access-token' \
--header 'Content-Type: application/json' \
--data-raw '{
    "grant_type": "password",
    "username": "user",
    "password": "password",
    "client_id": 1,
    "client_secret": "testtest"
}'

I have nay plugin associated with this service/route

Set route for auth service with paths /v1/authentication

I still getting 404

{
    "host": "authentication-service.hostelworld.com.docker.test.hostelworld.com",
    "id": "7c392680-4133-4f3e-933e-dabf8fca7b52",
    "protocol": "http",
    "read_timeout": 60000,
    "tls_verify_depth": null,
    "port": 80,
    "updated_at": 1610539946,
    "ca_certificates": null,
    "created_at": 1610475201,
    "connect_timeout": 60000,
    "write_timeout": 60000,
    "name": "authentication-service",
    "retries": 5,
    "path": "/v1/authentication",
    "tls_verify": null,
    "tags": [
        "testing"
    ],
    "client_certificate": null
}

Is there any log where I can see what URL kong is trying to reach?

I dont know why but it is working without the path in the service, so my request now is POST http://localhost:8000/access-token, but I want POST http://localhost:8000/authentication/access-token
Any idea?

Another thing is, why is it ignoring the Path handling which is v1 ?

{
    "next": null,
    "data": [
        {
            "host": "authentication-service.hostelworld.com.docker.test.hostelworld.com",
            "id": "7ccc6114-5b26-4af6-bd19-49356dd5729d",
            "protocol": "https",
            "read_timeout": 60000,
            "tls_verify_depth": null,
            "port": 443,
            "updated_at": 1610576708,
            "ca_certificates": null,
            "created_at": 1610563511,
            "connect_timeout": 60000,
            "write_timeout": 60000,
            "name": "authentication-service",
            "retries": 5,
            "path": "/",
            "tls_verify": null,
            "client_certificate": null,
            "tags": null
        }
    ]
}

route

{
    "next": null,
    "data": [
        {
            "strip_path": true,
            "tags": null,
            "updated_at": 1610576253,
            "destinations": null,
            "headers": null,
            "protocols": [
                "http",
                "https"
            ],
            "id": "f7583dc7-6680-43dd-bac2-970b967ba877",
            "created_at": 1610564205,
            "request_buffering": true,
            "hosts": null,
            "name": "authentication-service-test",
            "methods": [
                "POST"
            ],
            "service": {
                "id": "7ccc6114-5b26-4af6-bd19-49356dd5729d"
            },
            "preserve_host": false,
            "regex_priority": 0,
            "response_buffering": true,
            "sources": null,
            "paths": null,
            "https_redirect_status_code": 426,
            "path_handling": "v1",
            "snis": null
        }
    ]
}

So far I have seen that, you are update service.path, whereas you should updateroute.path.

ROUTE is the entry point for your gateway, which may forward request to any upstream service, at any service.path.

Once you have set route.path to v1/authentication, as suggested before - this will be used as entry point to gateway.


© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ