kylepaulsen / ResourceOverride

An extension to help you gain full control of any website by redirecting traffic, replacing, editing, or inserting new content.
MIT License
468 stars 117 forks source link

How to migrate to Requestly? #69

Open pramaths opened 3 weeks ago

pramaths commented 3 weeks ago

I have some of javascript redirects up in the Resource Override chrome extension. But it is no longer being maintained. So, I am moving on to a different solution called Requestly chrome extension.

I am finding it difficult to do so.

Has anyone here done it before ? Does Requestly allow importing rules from Resource Override? Please help.

sachinjain024 commented 3 weeks ago

Hey, @pramaths One of the core maintainers of Requestly here!

Requestly doesn't support importing configuration from Resource Override, I just checked different capabilities that R.O offers

  1. Redirects
  2. Inject Files
  3. Modify Headers

All of these capabilities exist in Requestly through different HTTP Rule Types.

I hope it helps!

sachinjain024 commented 3 weeks ago

I have created a Github Issue here. Please feel free to contribute directly to the source code or watch the issue.

In the meantime, you can use the following tips to migrate your JS redirects from Resource Override to Requestly.

You need to understand the different operators supported in Requestly. You can find the documentation here - https://docs.requestly.com/general/http-rules/advanced-usage/rule-operators

Case1. Exact Match in Resource Override

Resource Override Config 👇

From - http://www.ex.com/neat.js
To - http://local:8080/cool.js

This becomes a very straightforward setup in Requestly. Use the HTTP Redirect Rule with the "Equals" operator.

Request URL "Equals" http://www.ex.com/neat.js
Destination http://local:8080/cool.js

Case2. Wildcard Match in "Match URL"

Resource Override Config 👇

Match URL - http://www.ex.com/*.js
Replace URL - http://local:8080/*.js

In Requestly, Use the "Wildcard" operator and the substituted value should be replaced with $1,$2, etc.

e.g. In Requestly, You will use HTTP Redirect Rule like

URL "Matches Wildcard" http://www.ex.com/*.js
Destination URL - http://local:8080/$1.js

Case 3. Multiple Wildcard Operators

Resource Override Config 👇

Match URL - http://ex.com/*/**/***.js
Replace URL - http://local:8080/**/*/***.js

In Requestly, This becomes HTTP Redirect Rule with Wildcard Operator like

Request URL "Matches Wildcard" http://ex.com/*/*/*.js
Destination URL http://local:8080/$2/$1/$3.js

I hope this helps you migrate your configuration from Resource Override to Requestly. If you end up building a script for this, feel free to open a PR and contribute to the requestly repo.

PS - Looks like you raised a question on StackOverflow which I just answered - https://superuser.com/questions/1853105/how-to-migrate-to-requestly

pramaths commented 3 weeks ago

Sure, let me give it a try. I would have liked direct import but this is also fine