Fix for nginx redirect bug (see wiki for more info)