Fix History Support middleware to work with baseURL.

This was broken when history support was split out into its own middleware.