# Simple example with path, not host

**URL:** <https://discuss.konghq.com/t/simple-example-with-path-not-host/2507>\
**Category:** Questions\
**Tags:** kubernetes\
**Created:** [December 21, 2018, 10:51pm UTC](https://discuss.konghq.com/t/simple-example-with-path-not-host/2507 "2018-12-21T22:51:52Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![lomori](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/lomori/32/675_2.png) [@lomori](https://discuss.konghq.com/u/lomori)\
**Post date:** [December 21, 2018, 10:51pm UTC](https://discuss.konghq.com/t/simple-example-with-path-not-host/2507/1 "2018-12-21T22:51:52Z")

</div>

I’ve tried a bit but so far couldn’t get it to work. Is there a simple example somewhere for an Ingress configuration that uses only path instead of host.

Simplistic examples like the one below are not working for me, with and without KongIngress. The referred service exists and is working fine. Also, I’ve checked the kong database and don’t see anything there. On the other hand, if I create Ingress with host definition then I see the database being populated.

apiVersion: extensions/v1beta1  
kind: Ingress  
metadata:  
name: http-svc-ingress  
spec:  
rules:

- http:  
paths:
  - path: /http-svc  
backend:  
serviceName: http-svc  
servicePort: 80

apiVersion: [configuration.konghq.com/v1](http://configuration.konghq.com/v1)  
kind: KongIngress  
metadata:  
name: http-svc-ingress  
proxy:  
path: /http-svc  
route:  
strip\_path: true

Regards,  
Luiz

---

<div class="post-metadata">

**Author:** ![hbagdi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/hbagdi/32/562_2.png) [@hbagdi](https://discuss.konghq.com/u/hbagdi)\
**Post date:** [December 22, 2018, 1:51am UTC](https://discuss.konghq.com/t/simple-example-with-path-not-host/2507/2 "2018-12-22T01:51:58Z")

</div>

Which version of Ingress Controller and Kong are you using?

---

<div class="post-metadata">

**Author:** ![lomori](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/lomori/32/675_2.png) [@lomori](https://discuss.konghq.com/u/lomori)\
**Post date:** [December 22, 2018, 1:37pm UTC](https://discuss.konghq.com/t/simple-example-with-path-not-host/2507/3 "2018-12-22T13:37:11Z")

</div>

It’s whatever is defined in your master branch. I got it from here: [https://github.com/Kong/kubernetes-ingress-controller/blob/master/docs/deployment/openshift.md](https://github.com/Kong/kubernetes-ingress-controller/blob/master/docs/deployment/openshift.md).  
That works, but not when I try to have an api using path only, like above.

---

<div class="post-metadata">

**Author:** ![lomori](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/lomori/32/675_2.png) [@lomori](https://discuss.konghq.com/u/lomori)\
**Post date:** [December 26, 2018, 1:54pm UTC](https://discuss.konghq.com/t/simple-example-with-path-not-host/2507/4 "2018-12-26T13:54:38Z")

</div>

…and looking at the deployment configuration, these are the images being used:

[kong-docker-kubernetes-ingress-controller.bintray.io/kong-ingress-controller:0.2.0](http://kong-docker-kubernetes-ingress-controller.bintray.io/kong-ingress-controller:0.2.0)  
kong:0.14.1-centos

---

<div class="post-metadata">

**Author:** ![lomori](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/lomori/32/675_2.png) [@lomori](https://discuss.konghq.com/u/lomori)\
**Post date:** [December 26, 2018, 4:22pm UTC](https://discuss.konghq.com/t/simple-example-with-path-not-host/2507/5 "2018-12-26T16:22:32Z")

</div>

Also fails on Minishift. Interesting enough, it works with Minikube.

Anyway, you should be able to reproduce the issue. Standard install plus the Ingress definition above.

Luizs-MacBook-Pro:kong-ingress lomori$ http {PROXY\_IP}:{HTTP\_PORT}/http-svc  
HTTP/1.1 404 Not Found  
Connection: keep-alive  
Content-Length: 58  
Content-Type: application/json; charset=utf-8  
Date: Wed, 26 Dec 2018 16:17:41 GMT  
Server: kong/0.14.1

{  
“message”: “no route and no API found with those values”  
}

---

<div class="post-metadata">

**Author:** ![hbagdi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/hbagdi/32/562_2.png) [@hbagdi](https://discuss.konghq.com/u/hbagdi)\
**Post date:** [December 26, 2018, 6:05pm UTC](https://discuss.konghq.com/t/simple-example-with-path-not-host/2507/6 "2018-12-26T18:05:43Z")

</div>

This might be due to Openshift YAML definitions being out of date in master branch but the regular k8s YAMLs files are up to date as most people (including the devs) all use the regular k8s flavor.

I’ve added a task to my todo to update it. Meanwhile, a PR is also welcome.

---

<div class="post-metadata">

**Author:** ![lomori](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/lomori/32/675_2.png) [@lomori](https://discuss.konghq.com/u/lomori)\
**Post date:** [December 27, 2018, 2:21pm UTC](https://discuss.konghq.com/t/simple-example-with-path-not-host/2507/7 "2018-12-27T14:21:22Z")

</div>

Humm, didn’t see anything special there. It’s puzzling that the API selection by Host works but not by Path. Do you do anything special for the latter? I looked at the logs (normal level, v=3 is too verbose) and the Ingress appears to be trying to create the service/route (same output as for the Host case) and no errors are reported, but when I try to retrieve from the admin endpoint, it’s not there.

---

<div class="post-metadata">

**Author:** ![hbagdi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/hbagdi/32/562_2.png) [@hbagdi](https://discuss.konghq.com/u/hbagdi)\
**Post date:** [January 2, 2019, 5:53pm UTC](https://discuss.konghq.com/t/simple-example-with-path-not-host/2507/8 "2019-01-02T17:53:18Z")

</div>

It seems the version being used for Openshift is an older version.

From the changelog, path based routing was introduced in 0.2.1:

> <https://github.com/Kong/kubernetes-ingress-controller/blob/master/CHANGELOG.md#021---20181026>
