You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the headers section are commented out, requests with the path /webhook/foo/bar route to the specific webhook service, but with the headers sections present, it always routes to the generic webhook service, despite the specific one having the higher regex priority.
Here is the kong.conf we are using:
# nginx
nginx_daemon=off
nginx_worker_processes=2
proxy_listen = 0.0.0.0:8000 reuseport backlog=16384
admin_listen = 0.0.0.0:8001 reuseport backlog=16384
# this allows kong.client.get_forwarded_ip have the original client's ip
# instead of the load balancer's.
trusted_ips = 10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
real_ip_header = X-Forwarded-For
# logging
log_level = debug
proxy_access_log=/dev/stdout
admin_access_log=/dev/stdout
status_access_log=/dev/stdout
proxy_error_log=/dev/stdout
admin_error_log=/dev/stdout
status_error_log=/dev/stdout
# disable all headers
headers = off
# database
database=off
# cache
mem_cache_size = 2048m
# plugins
plugins = bundled
# paths
prefix = /usr/local/kong/
allow_debug_header = true
Expected Behavior
I expect two services with regex paths to be selected based on the higher regex priority.
Steps To Reproduce
Place the kong.yaml and kong.conf files in the appropriate places (see mounting below).
Uncomment the header sections of both routes in the provided kong.yaml.
Run Kong 3.4 from the base Kong Ubuntu Docker image:
docker run \
--publish 8000:8000 \
--volume "$PWD/etc/kong":/etc/kong \
--volume "$PWD/kong/declarative":/usr/local/kong/declarative \
--env KONG_DECLARATIVE_CONFIG='/usr/local/kong/declarative/kong.yaml' \
kong:3.4-ubuntu \
kong start
See a response header of Kong-Service-Name: generic-webhook.
Stop your kong docker container.
Comment out or delete the header section from the two routes in the provided kong.yaml.
Rerun your kong docker container with the command in step 3.
Make the same request from step 4.
See a response header of Kong-Service-Name: specific-webhook.
Anything else?
We have a custom plugin that sets the environment-region header based on authenticated data in the request during the rewrite-phase and use it to route between different deployments of services, but I have eliminated those parts of our use of Kong in the interest of a minimally reproducible setup. Just not having that header in our routes would constitute a giant change in our infrastructure, so I'd prefer to understand why having the header requirements is causing the generic route to "win" the priority race, rather than hear "just don't have the header".
The text was updated successfully, but these errors were encountered:
This is a known bug for the router priority. Could you please try switching to traditional flavor instead of the default traditional_compatible? Router Flavor.
Oh wow. Thanks, folks! Is there an existing issue about this that I should link to in a comment here in case it helps others find it and/or know it's relevance when I did not earlier?
We have an internal ticket for this. I think we can use this issue (#14457) for acknowledgment to other users. Thanks again for your very detailed report! 🚀
Is there an existing issue for this?
Kong version (
$ kong version
)3.4.2
Current Behavior
I have encountered what I think is a bug in service/routing prioritization when using regex routes with explicit priorities set.
With this minimal
kong.yaml
and DB mode off:When the headers section are commented out, requests with the path
/webhook/foo/bar
route to the specific webhook service, but with the headers sections present, it always routes to the generic webhook service, despite the specific one having the higher regex priority.Here is the
kong.conf
we are using:Expected Behavior
I expect two services with regex paths to be selected based on the higher regex priority.
Steps To Reproduce
kong.yaml
andkong.conf
files in the appropriate places (see mounting below).kong.yaml
.Kong-Service-Name: generic-webhook
.kong.yaml
.Kong-Service-Name: specific-webhook
.Anything else?
We have a custom plugin that sets the environment-region header based on authenticated data in the request during the rewrite-phase and use it to route between different deployments of services, but I have eliminated those parts of our use of Kong in the interest of a minimally reproducible setup. Just not having that header in our routes would constitute a giant change in our infrastructure, so I'd prefer to understand why having the header requirements is causing the generic route to "win" the priority race, rather than hear "just don't have the header".
The text was updated successfully, but these errors were encountered: