shakyShane / browser-sync-spa

Better Single Page App support for BrowserSync
29 stars 15 forks source link

proxy option in browser-sync not working #11

Open JJPandari opened 7 years ago

JJPandari commented 7 years ago

I'm not quite fimiliar with configuring frontend tools so I used a generator for yeoman to scaffold for me. I write both front and back ends and if I serve index.html with browser-sync, I have CORS issues, so I let my backend serve index.html and make browser-sync proxy it. Without spa, everything works fine, but if I browserSync.use(spa()), my.backend/foo still gives right response, while browser-sync.server/foo yields 404.

I actually feel better without auto history-api-fallback since I have control on backend, so I'm not sure if this is worth fixing for those really need browser-sync-spa. But it took me almost a day to find it's browser-sync's proxying going wrong(thought I was configuring backend's routes wrong), so if this is confirmed as a bug/limitation, maybe we should address it in the readme?

monkpit commented 6 years ago

I also see proxy is not working as I expect - I have a dev environment and I would like to use browser-sync to test in Chrome and IE at the same time on my local machine. I point all browsers to localhost:3000 and the homepage syncs perfectly, but any time I click on a link in the SPA my browsers will desync. When I click on an SPA link, the URL is rewritten as, for example, dev.test.com/link instead of localhost:3000/link. At this point my browsing on the main window does not sync to the other browsers.