-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Feature Request: Option for case sensitivity #1214
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
Comments
Hello! URIs are case insensitive (even if servers can handle them differently), so there's no reason to add an option to allow creating case sensitive routes to vue-router. It'll make things confusing and allow people to create routes that are wrong.
|
Hey @posva The specification you posted there is only talking about the scheme (http, ftp, ws, etc...) According to the rfc spec the scheme and host are case insensitive, but the path portion of the URI is supposed to be case sensitive. From https://tools.ietf.org/html/rfc3986#section-6.2.2.1
According to that the scheme, host and the hexidecimal parts of the path are case insensitive, but all other components should be case sensitive. |
Sorry, but there is no such statement in the RFC. |
That link above (https://tools.ietf.org/html/rfc3986#section-6.2.2.1) does say the other components are assumed to be case-sensitive.
And Section 6.2.3 (https://tools.ietf.org/html/rfc3986#section-6.2.3) has no mention of the path, so we can assume it to be case sensitive. |
I see that statement in the RFC... And nothing in the HTTP 1.1 RFC (https://tools.ietf.org/html/rfc7230#section-2.7) states otherwise, so it seems to me that the path should be case sensitive. GoogleBot also treats paths as case sensitive so there's some accepted industry practices as well. |
|
So if you are saying that |
I would think this reasoning is exactly why case sensitivity in urls should be an option in the vue router. That way the implementation can decide if urls should be case sensitive. IMHO the application using the framework is the implementation and should make implemenation decisions. As the framework, vue should empower the application to make these types of decisions. |
Well, PRs are always welcome. |
Paths should not be case sensitive but they can. On the other hand, query params like About the implementation: an SPA is half of the implementation, the other half being the server. If a user activates the case-sensitive paths, he also needs to make sure the server treats them correspondingly. But I'm pretty sure that's the default behaviour. For instance, Google cares about it while Stack Overflow doesn't. If you want to submit a PR, you need to add an option like |
Thanks, i will work on a PR |
…RegexpOptions to RouteRecord. Used to support senstive matches and pass along more options to pathToRegexp. vuejs#1214
Submitted PR #1215 |
…RegexpOptions to RouteRecord. Used to support senstive matches and pass along more options to pathToRegexp. vuejs#1214
* added caseSensitive and pathToRegexpOptions to RouteConfig and pathToRegexpOptions to RouteRecord. Used to support senstive matches and pass along more options to pathToRegexp. #1214 * changed test for /FooBar to redirect to /FOOBAR * fixed tests and added 2 tests for case sensitive redirects * added some route-matching tests * Update create-route-map.js * Update route-matching.js * Update code to use caseSensitive option * Add unit test for caseSensitive * Add test for pathToRegexpOptions in route * Fix flow typings * Add ts types * Remove old test
The default option for case sensitivity in
path-to-regexp
is false and I couldn't find an option to set it from a new Vue router instance. I'm trying to redirect some old paths in a project to new ones, and some of these new paths are just capitalized versions of the old, like/all-stores
to/All-Stores
but this causes an infinite redirect loop with the current setting.The text was updated successfully, but these errors were encountered: