Fix for redirect bug courtesty of Firebase team.
WIP: Create routine.