Fix 'bad URI' exception and return 500 instead if auth redirect cannot be done due to missing session cookie.