Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URIs with same prefix are not routed correctly #3021

Closed
kushmansingh opened this issue Nov 10, 2017 · 5 comments
Closed

URIs with same prefix are not routed correctly #3021

kushmansingh opened this issue Nov 10, 2017 · 5 comments
Labels
pending author feedback Waiting for the issue author to get back to a maintainer with findings, more details, etc... task/needs-investigation Requires investigation and reproduction before classifying it as a bug or not.

Comments

@kushmansingh
Copy link

kushmansingh commented Nov 10, 2017

Summary

Overlapping uris for an API definition are not routed correctly

Steps To Reproduce

  1. curl -X POST -d '{"name":"foo", "uris":"/a,/a-alternate", "upstream_url":"https://google.com"}' localhost:8001/apis
  2. curl localhost:8000/a will always route correctly too https://google.com
  3. curl localhost:8000/a-alternate will route to https://google.com correctly or https://google.com/-alternate which is incorrect.

Additional Details & Logs

  • Kong version (0.10.4)

However, if I have two separate API definitions, this will work fine as this was addressed in #2662

@bungle
Copy link
Member

bungle commented Nov 15, 2017

If have a feeling that /a-alternate may be considered as regex.

@bungle
Copy link
Member

bungle commented Nov 15, 2017

^- the above feeling is probably wrong (according to: https://github.com/Kong/kong/blob/master/kong/core/router.lua#L168), but this is indeed interesting case. I look more into it.

@thibaultcha thibaultcha added the task/needs-investigation Requires investigation and reproduction before classifying it as a bug or not. label Nov 16, 2017
@bungle
Copy link
Member

bungle commented Dec 8, 2017

Hmm... this seems to be the case, I couldn't reproduce this with httpie, but with curl I can:

First Request:

$ curl http://localhost:8000/a-alternate// -vv
*   Trying ::1...
* TCP_NODELAY set
* Connection failed
* connect to ::1 port 8000 failed: Connection refused
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8000 (#0)
> GET /a-alternate// HTTP/1.1
> Host: localhost:8000
> User-Agent: curl/7.54.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< Date: Fri, 08 Dec 2017 17:55:07 GMT
< Content-Type: text/html; charset=utf-8
< Content-Length: 173
< Connection: keep-alive
< Server: Werkzeug/0.13 Python/3.6.3
< X-Kong-Upstream-Latency: 2
< X-Kong-Proxy-Latency: 0
< Via: kong/0.10.4
< 
Location: /  <-- NOTE THIS!!!
X-Real-Ip: 127.0.0.1
X-Forwarded-For: 127.0.0.1
X-Forwarded-Proto: http
Host: localhost:8020
Connection: keep-alive
User-Agent: curl/7.54.0
Accept: */*

* Connection #0 to host localhost left intact

Second Request:

$ curl http://localhost:8000/a-alternate// -vv
*   Trying ::1...
* TCP_NODELAY set
* Connection failed
* connect to ::1 port 8000 failed: Connection refused
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8000 (#0)
> GET /a-alternate// HTTP/1.1
> Host: localhost:8000
> User-Agent: curl/7.54.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< Date: Fri, 08 Dec 2017 17:55:08 GMT
< Content-Type: text/html; charset=utf-8
< Content-Length: 185
< Connection: keep-alive
< Server: Werkzeug/0.13 Python/3.6.3
< X-Kong-Upstream-Latency: 1
< X-Kong-Proxy-Latency: 0
< Via: kong/0.10.4
< 
Location: /-alternate// <-- NOTE THIS!!!
X-Real-Ip: 127.0.0.1
X-Forwarded-For: 127.0.0.1
X-Forwarded-Proto: http
Host: localhost:8020
Connection: keep-alive
User-Agent: curl/7.54.0
Accept: */*

* Connection #0 to host localhost left intact

@bungle
Copy link
Member

bungle commented Dec 8, 2017

I cannot reproduce this with 0.11.2, @kushmansingh can you reproduce this with 0.11.2? I guess this might have to do with serf removal. Maybe something with cache got fixed with that as well(?).

@bungle bungle added the pending author feedback Waiting for the issue author to get back to a maintainer with findings, more details, etc... label Dec 8, 2017
@kikito
Copy link
Member

kikito commented Feb 15, 2018

Hi, I am closing this issue because of lack of activity. @kushmansingh, If you think it is still unresolved, please reopen with the requested information. Thanks!

@kikito kikito closed this as completed Feb 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending author feedback Waiting for the issue author to get back to a maintainer with findings, more details, etc... task/needs-investigation Requires investigation and reproduction before classifying it as a bug or not.
Projects
None yet
Development

No branches or pull requests

4 participants