redirect-web icon indicating copy to clipboard operation
redirect-web copied to clipboard

Redirect not working on scripts loaded by another script

Open ardunster opened this issue 10 months ago • 6 comments

I'm attempting to use this extension to do local development work by redirecting the address our script gets hosted at to my localhost dev server. The code runs inside a NextJS module federation so it needs the context of the entire website to work properly. This works great in Chrome with the Redirector plugin, and I hoped that this would do the same thing in Safari, but it doesn't seem to even try to load from localhost, it just loads our deployed code with no errors.

Addresses changed for privacy, but otherwise, here is the Redirector export json output:

{
    "createdBy": "Redirector v3.5.3",
    "createdAt": "2024-04-09T18:04:30.486Z",
    "redirects": [
        {
            "description": "Localhost",
            "exampleUrl": "https://project.example.com/remoteEntry.js?cb=862.8932411336993",
            "exampleResult": "http://localhost:3030/remoteEntry.js?cb=862.8932411336993",
            "error": null,
            "includePattern": "https://project.example.com/*",
            "excludePattern": "",
            "patternDesc": "",
            "redirectUrl": "http://localhost:3030/$1",
            "patternType": "W",
            "processMatches": "noProcessing",
            "disabled": false,
            "grouped": false,
            "appliesTo": [
                "stylesheet",
                "script",
                "image",
                "xmlhttprequest"
            ]
        }
    ]
}

vs Redirect Web's export:

{
  "appVersion" : "5.1.1",
  "bundleID" : "io.github.mshibanami.RedirectWebForSafari",
  "createdAt" : "2024-04-09T18:09:48.106Z",
  "kind" : "RedirectList",
  "redirects" : [
    {
      "captureGroupProcesses" : [

      ],
      "comments" : "",
      "destinationURLPattern" : "http:\/\/localhost:3030\/$1",
      "exampleURLs" : [
        "https:\/\/project.example.com\/remoteEntry.js?cb=862.8932411336993"
      ],
      "excludeURLPatterns" : [

      ],
      "isEnabled" : true,
      "kind" : "Redirect",
      "sourceURLPattern" : {
        "type" : "wildcard",
        "value" : "https:\/\/project.example.com\/*"
      },
      "title" : "Localhost"
    }
  ]
}

I don't see any options analogous to the "Applies to" field in Redirector. Is it even parsing requests made by one script to fetch another script? The example URL and resulting modification look correct, but it just isn't working at all.

ardunster avatar Apr 09 '24 18:04 ardunster