add 'localhost' support for redirect