-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
[Urgent]Can NOT match 'http://abc.com?trackingid=abc123' #636
Comments
If you use hash location ( That being said, I agree that redirect erasing query is unfortunate. For an urgent (but untested) fix, you can change function ensureSlash() {
var path = getHashPath();
if (path.charAt(0) === '/')
return true;
// ------------------
// I added these three lines:
if (window.location.search) {
path += window.location.search;
}
// ------------------
HashLocation.replace('/' + path);
return false;
} |
@gaearon however http://abc.com/?something=123#/ will not make redirect and hit the router. it seems the |
I don't quite understand why do you use URL like this at all? It is supposed to be http://abc.com/#/?lala=123, not the other way around. Query always goes at the end. Finally, to avoid #, you can just use https://github.com/rackt/react-router/blob/master/docs/api/run.md#location-optional |
Previously, in |
I think I'm starting to understand. Previous versions of router didn't support query (part after In 0.11, query is fully supported (you can read it in rotes and change it in Can you make your server emit http://abc.com/#/?trackingid=abc123 instead of http://abc.com/?trackingid=abc123#/`? |
I mean http://abc.com?trackingid=abc123#/ still works on 0.11, it will match the However, http://abc.com?trackingid=abc123 will emit If Maybe the redirection is caused by |
I fully agree with you here! This is what should happen if you apply small patch I wrote above. Let's wait for maintainers to weigh on this, but this should be a working solution for now. |
If you're using hash location, I think it should work like this:
In other words, we should treat a "native" query as just part of the base url that we don't care about. Hash routing, including router query params, come after the hash. |
A full page redirect I think is a bad idea, there are things the server might be doing with that and we'll mess up analytics/logs/etc. with a needless redirect. We can just ignore everything before the hash, and read in our fake query params. |
This makes sense. Pretty much how it works for path right now. |
I actually thought that's how it worked right now D: |
@rpflorence That's not how it currently works? |
Currently pre-hash query is erased. Pre-hash path is left intact. In 0.10, pre-hash query was preserved. |
Geez. Edge cases.. |
This was introduced in a07003e. Ah you fixed it already. Great! |
👍 Thanks for the great works! How about release a new version for this? @mjackson |
Are query strings still persisted on changing links? |
I tried to use
<Route name='app' handler={App} path='*' />
*
is supposed to match anything, but it can not match the url in title, and it will make a redirection tohttp://abc.com#/ and lost the
debug
parameter. which is quite unfortunate.I'm deadly need to fix this in my PRODUCTION env, thanks for your help guys.
The text was updated successfully, but these errors were encountered: