Suport both JSON and URL based redirecting