Skip to content

Opensource Kong API Gateway can route by header? #8020

Answered by liyangau
storehubdeploy asked this question in Help
Discussion options

You must be logged in to vote

Kong route object supports it by default.

Consider below as an example

services:
- name: first-svc
  url: https://httpbin.org/anything
  routes:
  - name: first-route
    hosts: ["example.com"]
    headers:
      test-header:
      - first
    paths:
    - /demo
- name: second-svc
  url: https://mockbin.org/request
  routes:
  - name: second-route
    hosts: ["example.com"]
    headers:
      test-header:
      - second
    paths:
    - /demo

Request -> http://example.com/demo -H "test-header:first" -> httpbin
Request -> http://example.com/demo -H "test-header:second" -> mockbin

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@storehubdeploy
Comment options

Answer selected by guanlan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
2 participants