I’m use kong with services and route, need create one service with many routes, some route whith JWT and other not, thomthing similiar to the next table .
| Route | Route in service | Plugins JWT |
|---------------|------------------|-------------|
|/service1 | / | True |
|/service1/url1 | /url1 | False |
|/service1/url2 | /url2 | False |
But routes un Kong are very simple, i tried with the option “Strip Path” but send all route:
Without “Strip Path”
“/service1/url1=>/”
With “Strip Path”
“/service1/url1=>/service1/url1”
I Need
“/service1/url1=>/url1”
I only see one soliction, creat one “service” with one “route” for each my the paths and configure path in the service, ejample.
service1: { host:service1, path:null, route { paths:[/service1 ]}}
service2: { host:service1, path:/url1, route { paths:[/service1/url1 ]}}
But this solution not felling good.
I have the same question.
A single service, with multiple endpoints and discreet public endpoints - e.g.
| Public Endpoint | Service host:port | Service endpoint |
| api.mycompany.com/api/endpointA | serviceA:portA | /endpointA |
| api.mycompany.com/api/endpointB | serviceA:portA | /endpointB |
| api.mycompany.com/api/endpointC | serviceA:portA | /endpointC |
As the original post suggests the only way I can get this to work is with three services, each with a single route. What would prefer is a single service with 3 routes.
@rbastian in order to change the URI as you need, you can use the Request Transformer Plugin. Please take a look at the config.replace.uri
option, you can use templates to capture only the URI portion you need and use it as the input for the updated URI.
@ruby232 you need different routes to have the JWT plugin enabled or disabled, but you also can use the Request Transformer Plugin to update the URIs to match the ones in the backend service.