Chrome extension redirects stuck on pending

Edit: this problem was sent to emetracker, it seems the problem with the chrome flash player: https://code.google.com/p/chromium/issues/detail?id=345160

I used a very simple chrome extension to redirect requests from one API to another. I am not very experienced when it comes to javascript or chrome add-ons, but the simple solution posted here was enough.

Since the last update, the redirected request is stuck on a "wait" in dev tools. Some search engines suggested that the new URL might be blocked by some other add-on, but I can reproduce this error with the latest version on a completely new installation. Redirecting still works when requesting an API URL directly, but not when requesting a flash application on a page, for example.

Here is the script "background.js" extension for URL redirection:

var host = "http://example.com";
chrome.webRequest.onBeforeRequest.addListener(
    function(details) {
         return {redirectUrl: host + details.url.match(/^https?:\/\/[^\/]+([\S\s]*)/)[1]};
    },
    {
        urls: [
            "*://example.org/api/*"
        ],
        types: ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"]
    },
    ["blocking"]
);

There are probably better ways to do this, but for me it was easy and good enough. I could not find the reason for this behavior in the latest version, can someone help me?

Thank.

+3
source share

All Articles