Add ajax redirect middleware support