Using this plugin broke all external pointing links
After implementing this plugin, we got major issues in production that all external pointing links directed to 404. This bug was not able to be reproduced locally.
It seems that the issue is that the plugin was trying to handle links that were using a normal href. The href apparently passed the checks to where it thinks it should handle it. It passed the url to the router, and got back the 404 route.
I think a reasonable fix would be to check the url in the href and look for a full url. For example, if the url starts with http://www.blah.com/mypath instead of /mypath, it probably shouldn't handle the transition. For now we removed the plugin and won't be able to consider implementing it again unless we are confident this could be fixed.
You can add a data-href-to-ignore attribute to any anchors that you don't want to be handled by href-to:
<a href="{{href-to 'contact-us'}}" data-href-to-ignore>
If you have a catchall route (this.route('catchall', { path: "/*" })),
you need to add the attribute "data-href-to-ignore",
otherwise you will always match it
</a>
Will that solve your particular problem?
Hmm, I suppose that could be done, but it seems like an unnecessary addition to be made to every external link, when it would be easy enough to assume that it shouldn't handle full urls. Then we wouldn't have to make markup changes to every external link in our code base in order to adopt the plugin.
I think it's likely that we'll add support for automatically skipping external URLs, I just want to give it a little though first.
Related #41, #57
I 👍 on adding this. If anyone want to implement this, please do
One complication: if you have a catch-all route like
this.route('not-found', { path: '/*path' })
then recognizeUrl will return true for any URL prefixed with the app's root.
We have a number of applications mounted at different paths within the same origin. This shows up as a problem for the one app mounted at / since every other app has that app's root as a prefix.