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

Case-insensitive path matching #35

Closed
jblackburn21 opened this issue Jan 12, 2016 · 10 comments
Closed

Case-insensitive path matching #35

jblackburn21 opened this issue Jan 12, 2016 · 10 comments
Milestone

Comments

@jblackburn21
Copy link

I have added this route to test with, but the path matching appears to be case-sensitive.

route add orders /orders http://localhost:8080/ tags "urlprefix-/orders"

A request to this url works correctly: http://localhost:9999/orders

However, a request to this URL: http://localhost:9999/Orders
logs this warning: [WARN] No route for localhost:9999/Orders

Is it possible for the path matching to be case-insensitive? This would lessen the burden on the client to request the route with matching case.

@magiconair magiconair changed the title Case-sensitive path matching Case-insensitive path matching Jan 12, 2016
@magiconair
Copy link
Contributor

If I look at http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html section 3.2.3 I find this:

3.2.3 URI Comparison

When comparing two URIs to decide if they match or not, a client SHOULD use a case-sensitive octet-by-octet comparison of the entire URIs, with these exceptions:

  - A port that is empty or not given is equivalent to the default
    port for that URI-reference;
    - Comparisons of host names MUST be case-insensitive;
    - Comparisons of scheme names MUST be case-insensitive;
    - An empty abs_path is equivalent to an abs_path of "/".

Characters other than those in the "reserved" and "unsafe" sets (see RFC 2396 [42]) are equivalent to their ""%" HEX HEX" encoding.

@magiconair
Copy link
Contributor

You can just register both routes but my suggestion is to fix your app.

@jblackburn21
Copy link
Author

Thanks for the quick response. We are looking at using this with several ASP.NET Web API projects, which is case-insensitive. However, I believe we can make adjustments for this to work.

@magiconair
Copy link
Contributor

let me know how this works out.

@herbrandson
Copy link
Contributor

herbrandson commented Sep 17, 2018

This is actually preventing us from migrating to using Fabio. We have been using dcos/marathon-lb which allows for case insensitive urls. Because of this, switching to using Fabio would be a breaking change for us. It would be awesome if perhaps we could do something like urlprefix-SomeService strip=/SomeService ignoreCase=true

@herbrandson
Copy link
Contributor

After thinking about that request some more, I don't think we really care about ignoring case on a route-by-route basis. I think a command line switch to ignore case on all routes would be better (and I suspect significantly easier to implement in a performant way).

@magiconair
Copy link
Contributor

@herbrandson I think adding another matcher in https://github.com/fabiolb/fabio/blob/master/route/matcher.go and adding a config option in https://github.com/fabiolb/fabio/blob/master/config/load.go#L250-L252 should do the trick.

Feel free to send a PR.

@herbrandson
Copy link
Contributor

I can't tell you how happy this makes me :)

I'll try to send a PR in the next couple of days.

@herbrandson
Copy link
Contributor

PR sent: #553

@magiconair magiconair reopened this Sep 20, 2018
@magiconair
Copy link
Contributor

Merged #553

@magiconair magiconair added this to the 1.5.11 milestone Oct 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants