Skip to content

How to Fix Kong Service and Route Configuration Error

DodaTech Updated 2026-06-24 2 min read

In this tutorial, you'll learn about How to Fix Kong Service and Route Configuration Error. We cover key concepts, practical examples, and best practices.

Kong returns {"message":"no Route matched with those values"} or HTTP 404 when making requests through the proxy — the service and route configuration does not match the incoming request.

The Problem

$ curl http://localhost:8000/api/users
{"message":"no Route matched with those values"}

Step-by-Step Fix

Step 1: Create a service

curl -i -X POST http://localhost:8001/services \
  --data "name=api-service" \
  --data "url=http://backend:3000"

Expected:

HTTP/1.1 201 Created
{"name":"api-service","host":"backend","port":3000}

Step 2: Create a route for the service

curl -i -X POST http://localhost:8001/services/api-service/routes \
  --data "name=api-route" \
  --data "hosts[]=api.example.com" \
  --data "paths[]=/api"

Step 3: Test the route

curl -i -H "Host: api.example.com" http://localhost:8000/api/users

Step 4: Verify route matching

# List all routes
curl -s http://localhost:8001/routes | jq '.data[].name'

Step 5: Debug with headers

# Show which route matched
curl -v -H "Host: api.example.com" http://localhost:8000/api/test

Prevention Tips

  • Use specific hosts and paths to avoid ambiguity
  • Test routes with curl -v to see matching behavior
  • Order more specific routes before wildcard routes
  • Check route priority: regex_priority and strip_path flags

Common Mistakes with service route

  1. Overlapping type class instances that cause GHC to reject the program with ambiguous dispatch errors
  2. Non-exhaustive pattern matches that compile with warnings then crash at runtime
  3. Misunderstanding that String is [Char] with poor performance for large text operations

These mistakes appear frequently in real-world KONG code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### Why does Kong return "no Route matched with those values"?

The incoming request does not match any route's hosts, paths, or methods list. Check that the Host header and path prefix in your request match exactly what was configured in the route.

What is the difference between hosts and paths in a route?

hosts match the HTTP Host header (e.g., api.example.com), while paths match the URL prefix (e.g., /api). Routes require at least one of these. You can use both for more specific matching.

How do I debug which route Kong is matching?

Add KONG_LOG_LEVEL=debug to Kong's environment. Each request is logged with the route matching decision: [debug] matched route: api-route (api-service).

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro