This is a migrated thread and some comments may be shown as answers.

How to replace an online folder by local folder?

3 Answers 2284 Views
Fiddler Classic
This is a migrated thread and some comments may be shown as answers.
Yevgeniy
Top achievements
Rank 1
Yevgeniy asked on 20 Sep 2019, 02:25 PM

I'm struggling to make my browser fetch all files from local folder instead of all files from target online folder.
I want to achieve it using Fiddler's AutoResponder.
As I understood, I should write corresponding regular expressions for target online folder and for local folder as well. But I can't figure out how they should look. In another proxy debugger, Charles Proxy, it would be basically this easy:

local path: c:\local_folder

Same approach didn't work in Fiddler for me. Then I've found some example (https://groups.google.com/forum/#!topic/httpfiddler/BWfUoCuih8k) by Eric Lawrence, but either it is irrelevant, or I'm applying it incorrect. Anyway it doesn't work for me too. I've tried something like this:

REGEX:C:\local_folder\$1

So, please, give me a hint, how regexps for replacing whole folder (online) to whole folder (local) should be written in Fiddler.

If there is another way beside regexps, I would like to know it as well.
Thank you!

3 Answers, 1 is accepted

Sort by
0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 24 Sep 2019, 08:39 PM

Hi Yevgeniy,

I am not certain that REGEX will be the best approach for this. There is a nice post on OhadSoft's blog about Mapping Network Resources to Local Files using Fiddler that may be helpful.

I hope this helps. Please let me know if you need any additional information. Thank you for using the Fiddler Forums.

Regards,


Eric R | Technical Support Engineer
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Yevgeniy
Top achievements
Rank 1
answered on 24 Sep 2019, 10:51 PM

Thank you for your reply, Eric!
I'm afraid, Mapping network resources to local files using Fiddler post doesn't fit in my case as there explained how to map single online file to single local file, so Fiddler is able to replace one by another - and I want to map whole folder at once.
Example:

  1. There is some site "examplesite.com"
  2. This site includes folder named "target_folder", which contains this files:
  • picture1.jpg
  • picture2.jpg
  • code1.js
  • code2.js
  • configuration1.json
  • sound1.mp3

I have copy of that folder on my pc. And I don't want to manually map in AutoResponder "picture1.jpg" (online) to "picture1.jpg" (local), then "picture2.jpg" (online) to "picture2.jpg" (local) etc. Because mapping file by file may be very time consuming, especially in case there are lot of files within folder.

Instead of mapping file by file I want to give this instruction to AutoResponder:

"when http response includes file, whose parent folder is "examplesite.com/target_folder", - replace it by same file from here "C:\local_folder" ".
So then "picture1.jpg", "picture2.jpg", "code1.js", "code2.js", "configuration1.json" and "sound1.mp3" will be replaced by local files with same name and format automatically.

I'm pretty sure that can be done using Fiddler's AutoResponder, but I don't know how exactly to do it.
So, any suggestions would be much appreciated :)

0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 25 Sep 2019, 09:27 PM

Hi Yevgeniy,

Apologies for my misunderstanding. In this case, Regular Expressions might be the better approach. See the AutoResponder Regular Expressions Knowledge Base Article for more details.

I hope this helps. Please let me know if you need any additional information. Thank you.

Regards,


Eric R | Technical Support Engineer
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
shashank
Top achievements
Rank 1
commented on 27 Dec 2021, 03:29 AM

How can we redirect a request url (containing https protocol) to a local file via C# fiddler extension. I tried using oSession.fullUrl = <Complete local file path> but it throws error of URI schema not being https, https and ftp. Is there any way how we are achieving the same via AutoResponder, the same can be achieved via extension ? Thanks in advance for help :)
Nick Iliev
Telerik team
commented on 27 Dec 2021, 11:34 AM

Hey shashank,

 

Check the flag x-replywithfile  as taken from the FIddler book.

Respond to a request with a file loaded from the \Captures\Responses folderif (oSession.PathAndQuery=="/version1.css") {
  oSession["x-replywithfile"] ="version2.css";
}
OnBeforeRequest
or
OnBeforeResponse

 

Tags
Fiddler Classic
Asked by
Yevgeniy
Top achievements
Rank 1
Answers by
Eric R | Senior Technical Support Engineer
Telerik team
Yevgeniy
Top achievements
Rank 1
Share this question
or