Skip to content

Bad middleware makes all requests hang #194

Closed

Description

@raymondfeng

In app.js, if we configure the LoopBack app as follows:

app.use(require('cors'));

All requests will hang.

Please note the correct usage of cors is app.use(require('cors')());

The issue was discovered by @Schoonology

Activity

  1. ritch commented on Feb 19, 2014

    @ritch
    Member

    This is really an issue with express middleware. Any function can be a middleware, and middleware are not required to callback.

    A potential helper would be middleware specific timeouts. Maybe something like this...

    app.use(uploader(), 60 * 1000 * 5); // 5 minute timeout
    app.use(liveStreamer(), Infinity); // explicitly never timeout
    app.use(rest()); // default is something reasonable ~ 60 minutes
  2. added this to the milestone on Mar 21, 2014
  3. bajtos commented on Jul 15, 2014

    @bajtos
    Member

    In my opinion, this issue should be addressed by expressjs.

  4. fabien commented on Aug 23, 2014

    @fabien
    Contributor

    Now that Express is here at Strongloop, I think we should close this here and open a ticket there.

  5. modified the milestone: #Rel lb 2.0.0 on Sep 30, 2014
  6. dougwilson commented on Nov 7, 2014

    @dougwilson

    Use the connect-timeout module.

  7. bajtos commented on Nov 26, 2014

    @bajtos
    Member

    The declarative way of registering middleware via middleware.json made this issue obsolete (see #739).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions