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

Hostnames and Wildcards?

1 Answer 398 Views
Fiddler Classic
This is a migrated thread and some comments may be shown as answers.
Derek
Top achievements
Rank 1
Derek asked on 22 Jun 2015, 08:27 PM

 Currently I have Fiddler's Host Remapping feature configured like so:

127.0.0.1:10092     *WebsiteA.com
127.0.0.1:10092     *WebsiteA.de
127.0.0.1:10092     *WebsiteA.es
127.0.0.1:10092     *WebsiteA.co.uk
127.0.0.1:10092     *WebsiteA.fr
127.0.0.1:10092     *WebsiteA.it
 
127.0.0.1:10091     *m.WebsiteB.com
127.0.0.1:10091     *m.WebsiteB.com.au
127.0.0.1:10091     *m.WebsiteB.de
127.0.0.1:10091     *m.WebsiteB.es
127.0.0.1:10091     *m.WebsiteB.co.uk
127.0.0.1:10091     *m.WebsiteB.fr
127.0.0.1:10091     *m.WebsiteB.it
                       
127.0.0.1:10093     *WebsiteB.com
127.0.0.1:10093     *WebsiteB.com.au
127.0.0.1:10093     *WebsiteB.de
127.0.0.1:10093     *WebsiteB.es
127.0.0.1:10093     *WebsiteB.co.uk
127.0.0.1:10093     *WebsiteB.fr
127.0.0.1:10093     *WebsiteB.it

How can I use a wildcard for the Top Level Domain?

I tried to use the code below in the Fiddler Rules script's OnBeforeRequest() but am not having success. How can this be done?

if (oSession.host.Contains('.websiteB.')) {
   //oSession.host='127.0.0.1';
    oSession.m_hostIP= '127.0.0.1';
    oSession.port=10091;
   // MessageBox.Show(oSession);         
}

 

1 Answer, 1 is accepted

Sort by
0
Eric Lawrence
Telerik team
answered on 23 Jun 2015, 05:55 PM
Hello, Derek--

I'm not sure if your example is using made up names? If not, the most direct problem is that .Contains is a case-sensitive function, but the hostnames sent by clients are almost always in lowercase. Hence, asking if a hostname contains any string containing uppercase letters will almost always return false.

Your code should look like this:

  if (oSession.host.Contains('.websiteb.')) {
    oSession["X-OverrideHost"] = '127.0.0.1:10091';
  }


Regards,
Eric Lawrence
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
Tags
Fiddler Classic
Asked by
Derek
Top achievements
Rank 1
Answers by
Eric Lawrence
Telerik team
Share this question
or