Prevent multiple vhost responses #395

merged 1 commit into from Oct 19, 2011

3 participants


Currently, vhost evaluates all matching subdomains and and executes ALL requests to vhost servers. This causes multiple responses to be served. Example:

  connect.vhost('', connect.createServer(...middleware...)),
  connect.vhost('*', connect.createServer(...middleware...))

A call to causes both servers to be invoked. Is this by design? Is there any real-world use-case for this? It seems much more intuitive to call just the first server (ie. depend on ordering when multiple matching declarations are found).

If this change is rejected, the only other way how to accomplish the above is via unwieldy regexp like following, and that seems just wrong:

  connect.vhost('', connect.createServer(...middleware...)),
  connect.vhost('*(?<!static)', connect.createServer(...middleware...))


Sencha Labs member
tj commented Oct 19, 2011

nope you're right, definitely a bug

@tj tj merged commit c388999 into senchalabs:master Oct 19, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment