browser-sync-spa
browser-sync-spa copied to clipboard
Links that include a dot are routed incorrectly
I've been debugging this problem for a while now and I am reasonably sure that it stems from this library, but please correct me if I'm wrong.
I'm using browser-sync and browser-sync-spa with gulp, generated from the yeoman gulp-angular generator. If I try to serve a url with a dot in it, the server seems to be confused and tries to route it away from my code. I'm guessing it is trying to serve a physical file, but the dot is just part of my angular route.
My particular problem is that I have a route for user activation that includes an email address:
localhost:3001/activate/key/[email protected]
Is there any way to tell the server that this is part of the route and not an actual file?
I believe this is due to the default behaviour of connect-history-api-fallback which is used internally in browser-sync-spa to serve fallback pages.
Take a look at the rewrite
option (particularly the jquery example) - presumably you could match your email address route with a rewrite rule to return the default html page.
Looks like that would probably work. I ended up changing my route to use query parameters instead:
/activate?key=key&[email protected]