Vince
September 3, 2020, 7:31am
1
Hi everyone,
I initially reported the following as a bug on github but I might have been too fast in considering this as such:
opened 08:47AM - 01 Sep 20 UTC
closed 08:16PM - 27 Mar 21 UTC
needs-triage
stale
### Summary
A trailing slash is automatically added to the path of the upstre… am_uri while it's not defined in the service path. As the path known on the destination does not contain any trailing slash, we get a 404.
Is there a way to prevent the trailing slash to be automatically added?
**Kong Ingress controller version**
0.9.0
**Kong version**
2.0.2
### Kubernetes version
```
Client Version: version.Info{Major:"1", Minor:"16+", GitVersion:"v1.16.6-beta.0", GitCommit:"e7f962ba86f4ce7033828210ca3556393c377bcc", GitTreeState:"clean", BuildDate:"2020-01-15T08:26:26Z", GoVersion:"go1.13.5", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.7", GitCommit:"5737fe2e0b8e92698351a853b0d07f9c39b96736", GitTreeState:"clean", BuildDate:"2020-06-24T19:54:11Z", GoVersion:"go1.13.6", Compiler:"gc", Platform:"linux/amd64"}
```
### Environment
AKS + Installation via Helm
### What happened
A trailing slash is automatically added to the path of the upstream_uri while it's not defined in the service path. As the path known on the destination does not contain any trailing slash, we get a 404.
Is there a way to prevent the trailing slash to be automatically added?
### Expected behavior
No trailing slash is added to the upstream_uri
### Steps To Reproduce
1. Install a pod exposing an endpoint at a specific path without trailing slash, by example '/foo'.
2. Create a service and ingress. The ingress path is different from the endpoint path, by example '/kung'
3. Create a kongIngress such that the strip_path property of the route section is set is true and with the path property of the proxy set to '/foo'.
4. Link the the kongIngress with the service and the ingress
### Additional details & logs
Here is the output of the file-log plugin:
```
{
...
"service" : {
...
"path" : "/foo",
...
},
"response" : {
...
"status" : 404,
"headers" : {
...
}
},
"upstream_uri" : "/foo/",
...
}
```
In another environment where we are still using kong 1.4.2 and the kong-ingress-controller 0.7.0 we do not have the problem. Here is the output of the file-log plugin in that other environment:
```
{
"service" : {
...
"path" : "/foo",
...
},
...
"upstream_uri" : "/foo",
...
}
```
Is this expected default behaviour and can we tune it by using some settings?
Thanks in advance!
traines
September 17, 2020, 6:25pm
2
Hey! Have responded in https://github.com/Kong/kubernetes-ingress-controller/issues/819#issuecomment-693730920
Short version there is that this isn’t expected, but also isn’t something we can reproduce on current versions. That may be a version difference of some sort, but not one that I recognize immediately (I don’t think that part of the router and/or controller have changed since the versions you mentioned, but I could be wrong).