Adding middleware required for bug 838251.