Skip to content
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

BrowserSync Server mishandling routes with dots #205

Open
FossPrime opened this issue Sep 8, 2016 · 2 comments
Open

BrowserSync Server mishandling routes with dots #205

FossPrime opened this issue Sep 8, 2016 · 2 comments

Comments

@FossPrime
Copy link
Contributor

/recipeingredient/parent/65.html

a route such as that will not go to symfony. Would love comments/documentation on grunt/browserSync.js it's a bit of a mess in there.

related to #192

@FossPrime
Copy link
Contributor Author

I fixed this on my installation with a custom router (app_node.php) that handles all requests for clarity. I could give some requests to the built in server, but that makes the CLI logs look weird, only returning unrouted static files. The other option is to mimic the logs, which is beside the point.

Once php can handle all routes bin/console server:start will work and the browsersync config can be reduced to almost nothing. This is certainly the way to go.

Most of the php routers out there are quite powerful, all we need is a simple php static file router... I may throw one at composer if no one has a better idea.

@FossPrime
Copy link
Contributor Author

FossPrime commented Sep 12, 2016

That solution breaks the service worker... :/

500 (Service Worker Response Error) browser-sync-client.2.11.2.js:1

UPDATE: It's a socket.io component of BrowserSync... meaning we should really not handle that with php, but instead have middleware handle it.

UPDATE2:
This dumbed down middleware router does the job... though ServiceWorkers are pain for development... it keeps loading a cache of my javascript when browsersync sends a reload after detecting a change.

                middleware: [
                    function(req, res, next) {
                      var obj = parseurl(req);
                      if ( !/^\/browser-sync/.test(obj.pathname) ) {
                          grunt.bsMiddleware(req, res, next);
                      } else {
                          next();
                      }
                    }
                ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant