I am writing an extension that uses chrome.webRequest.onBeforeRequest.addListener to perform a redirect, based on the url of the request:
chrome.webRequest.onBeforeRequest.addListener