browser-sync-spa icon indicating copy to clipboard operation
browser-sync-spa copied to clipboard

Links that include a dot are routed incorrectly

Open brianchaan opened this issue 9 years ago • 2 comments

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?

brianchaan avatar Jul 20 '15 19:07 brianchaan

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.

at0g avatar Sep 13 '15 06:09 at0g

Looks like that would probably work. I ended up changing my route to use query parameters instead:

/activate?key=key&[email protected]

brianchaan avatar Sep 17 '15 15:09 brianchaan