I'm using Kong without database and I need to route request based on request header: x-forwarded-host
.
I'm referring to the doc: https://docs.konghq.com/hub/kong-inc/route-by-header/
But it doesn't provide examples for the "without database" version.
Then I noticed that route-by-header is not in the compatible plugin list in https://docs.konghq.com/1.4.x/db-less-and-declarative-config/
So my questions are:
- Does DB-less Kong support route-by-header plugin?
- Is there any way to route by request header in DB-less Kong?
Updates:
- Just found out that the route-by-header plugin is probably not compatible with DB-less Kong, and it's for enterprise subscription only.
- Since Kong 1.3, a feature has been added to allow routing by request header in the Routes definition https://docs.konghq.com/1.3.x/proxy/#request-header
- But it doesn't provide examples for the declarative config format for DB-less Kong. So I need to figure out the correct format for this feature.
Resolved: In the declarative configuration file, add:
routes:
- name: my-routes
headers:
x-forwarded-host: ["xxx.xxx.com"]
paths: ["/xxx/api"]
This will match the route based on both headers and paths