Comments (10)
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: my-ingress
annotations:
konghq.com/strip-path: "true"
kubernetes.io/ingress.class: kong
spec:
rules:
- host: my.host.local
http:
paths:
- path: /sample/
backend:
serviceName: my-svc
servicePort: 80
from kubernetes-ingress-controller.
Hi @hbagdi
When I call this url http://my.host.local/sample the path /sample is sent to upstream service. This is a expected behavior for kong-ingress? I expected that the path will not sent to upstream service.
curl --header "Host: my.host.local" http://200.x.x.x/sample -vvv
* Trying 200.x.x.x...
* TCP_NODELAY set
* Connected to 200.x.x.x (200.x.x.x) port 80 (#0)
> GET /sample HTTP/1.1
> Host: my.host.local
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Content-Type: text/plain; charset=UTF-8
< Content-Length: 0
< Connection: keep-alive
< X-Powered-By: Sails <sailsjs.org>
< Date: Fri, 10 Aug 2018 14:10:15 GMT
< X-Kong-Upstream-Latency: 2
< X-Kong-Proxy-Latency: 0
< Via: kong/0.13.1
<
* Connection #0 to host 200.x.x.x left intact
from kubernetes-ingress-controller.
Hello @Lmorais,
What you're seeing is an expected behavior.
The annotation you're using is supported by ingress-nginx but not by Kong Ingress Controller.
Kong by default will strip the path for you so you don't need to add that annotation to your Ingress resource.
Thank you for opening this issue.
from kubernetes-ingress-controller.
I'm not sure if I see upstream being sent /sample
in the cURL output you've posted above. It seems like Kong is proxying the request (Via
header).
Do you see a log in your service which says that it received /sample
?
Is there an echo endpoint in your upstream service which could be handy for your debugging?
from kubernetes-ingress-controller.
I'm having the same problem. I do see in my upstream service logs that the path is not being stripped, and when I query the Kong Admin API for the route created for the ingress, I see that strip_path is false.
from kubernetes-ingress-controller.
@Lmorais @hbagdi As mentioned above, I found that strip_path was not being set by default (v0.0.5). I achieved a request path rewrite by creating a KongIngress, like so:
apiVersion: configuration.konghq.com/v1
kind: KongIngress
metadata:
name: echo-ingress
route:
strip_path: true
...corresponding to this ingress:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: echo-ingress
annotations:
kubernetes.io/ingress.class: nginx
spec:
rules:
- host: foo.bar
http:
paths:
- path: /echo
backend:
serviceName: echo-service
servicePort: 8080
That takes care of the rewrite, although I found that that if the ingress already exists, it must be deleted and re-created to pick up the config from the KongIngress, per #56 (comment)
Note, though, that I haven't got this extremely basic example working without specifying a host, which I don't actual want to do. (#84)
from kubernetes-ingress-controller.
Hello @andrewtappert
That takes care of the rewrite, although I found that that if the ingress already exists, it must be deleted and re-created to pick up the config from the KongIngress, per #56 (comment)
This should not be required with Ingress controller 0.1.0. This bug was fixed in #92
It seems like the ingress controller is creating routes with strip_path
set to false by default, in which case, as you figured out, you will need to use KongIngress
resource to set it to false.
from kubernetes-ingress-controller.
Hi @hbagdi
ingress controller version: 0.2.2
strip_path
is set to false for any created rules, is that expected?
from kubernetes-ingress-controller.
strip_path
is now false by default, since KIC 0.8.0
from kubernetes-ingress-controller.
apiVersion: extensions/v1beta1 kind: Ingress metadata: name: my-ingress annotations: konghq.com/strip-path: "true" kubernetes.io/ingress.class: kong spec: rules: - host: my.host.local http: paths: - path: /sample/ backend: serviceName: my-svc servicePort: 80
This solution work for me, thanks.
from kubernetes-ingress-controller.
Related Issues (20)
- Test Request: Kong Gateway EE version 2.8.4.7-rc1 HOT 8
- HTTPRoute with RedirectURI feature
- Test Request: Kong Gateway EE version 3.6.0.0-rc.7 HOT 3
- Test Request: Kong Gateway EE version 3.6.0.0-rc.8 HOT 3
- Test Request: Kong Gateway EE version 3.4.3.4-rc1 HOT 3
- `helm template kong kong/ingress` does not produce the same output like `helm template kong kong/ingress --validate`
- Automated triggering of Test Request runs
- FillID breaks syncing with duplicate consumers in different namespaces/workspaces HOT 1
- Kong / kubernetes-ingress-controller : Error: parse error at (kong/templates/_helpers.tpl:1281): unclosed action HOT 5
- Listener certificates are not used when coming from managed gateways
- Configuration apply error from applying 2 Prometheus plugins against 1 `Service` fails to be parsed
- Frequent kong ingress controller leader re-election happening HOT 3
- When configuring Kong Gateway OSS, KIC tries to apply KongLicense regardless and fails HOT 2
- Cannot apply licenses to DB backed Kong gateways HOT 1
- Update more real-time `status.conditions` for license validity in KongLicense controller
- Support vaults and licenses in config fetcher
- Test Request: Kong Gateway EE kong/kong-gateway-dev:3.6.1.0-rc1 HOT 3
- Startup issue with KIC wipes database HOT 1
- Use generated ValidatingWebhookConfiguration in integration tests
- Release 3.1.1 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kubernetes-ingress-controller.