Apply before filter to stop redirect loop