{"action":"opened","issue":{"url":"https://api.github.com/repos/apigee-127/swagger-tools/issues/256","labels_url":"https://api.github.com/repos/apigee-127/swagger-tools/issues/256/labels{/name}","comments_url":"https://api.github.com/repos/apigee-127/swagger-tools/issues/256/comments","events_url":"https://api.github.com/repos/apigee-127/swagger-tools/issues/256/events","html_url":"https://github.com/apigee-127/swagger-tools/issues/256","id":98793933,"number":256,"title":"Middleware does not honor Connect mount-points","user":{"login":"whitlockjc","id":98899,"avatar_url":"https://avatars.githubusercontent.com/u/98899?v=3","gravatar_id":"","url":"https://api.github.com/users/whitlockjc","html_url":"https://github.com/whitlockjc","followers_url":"https://api.github.com/users/whitlockjc/followers","following_url":"https://api.github.com/users/whitlockjc/following{/other_user}","gists_url":"https://api.github.com/users/whitlockjc/gists{/gist_id}","starred_url":"https://api.github.com/users/whitlockjc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whitlockjc/subscriptions","organizations_url":"https://api.github.com/users/whitlockjc/orgs","repos_url":"https://api.github.com/users/whitlockjc/repos","events_url":"https://api.github.com/users/whitlockjc/events{/privacy}","received_events_url":"https://api.github.com/users/whitlockjc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-03T16:59:03Z","updated_at":"2015-08-03T16:59:03Z","closed_at":null,"body":"Connect's `app.use` allows you to use a *mount-point* to allow for middleware to only be registered for a particular base path.  So instead of `app.use(swaggerMetadata)`, you could use `app.use('/some/path', swaggerMetadata)`.  Where the swagger-tools middleware gets tripped up is that `req.url` is the URL **after** the mount-point which means `req.url` will be `/docs` for a request of `/some/path/docs` when using the `/some/path` mount-point.  Since all of swagger-tools middleware was written to work with the full URL, we need to update the pertinent middlewares to use `req.originalUrl || req.url` instead of just `req.url`.\r\n\r\nWas originally reported in #250."}}