Fixes bugs 978098, 978100, 978102, 974084 - Use query string parameters in the middleware and the webapp. r=peterbe