Host Remapping and the Host httpheader

894 views
Skip to first unread message

powlette

unread,
Jan 28, 2010, 10:06:45 AM1/28/10
to Fiddler
The Host Remapping is a great feature, but since it doesn't override
the Host header in the request, it doesn't work with CDN servers. For
example, if I make this rule:

google.com yahoo.com

and then visit "yahoo.com", I get google's homepage which is great,
but I see in the request that the request headers contain "Host:
yahoo.com" which google apparently ignores, but when visiting a site
that hosts multiple domains with different host names, it no longer
works.

Is there (or can there be) an option to not only redirect requests to
the remapped host/IP BUT ALSO remap the Host http header to match?

EricLaw

unread,
Jan 28, 2010, 10:20:06 AM1/28/10
to Fiddler
If you want to redirect a request from one host to another (rather
than redirecting requests from one IP to another as the Windows Hosts
file does) then you presently need to write a little bit of script to
do so...

if (oSession.HostnameIs("foo.com")) { oSession.Hostname =
"bar.com" }

Or, you could type

urlreplace foo.com bar.com

in the QuickExec box.

Offering a way to add a parameter for each line in the HOSTS window is
an interesting idea. It wouldn't match the syntax of the "real"
windows hosts file, but should be pretty easy to do.

Rohini R

unread,
Aug 21, 2014, 4:43:07 PM8/21/14
to httpf...@googlegroups.com
I am a tester and trying to test my website using latest version of the code in the dev path .How to remap using the same domain but different path

For example I need to

Map from :
Host : tags/123.com
path : 123/bootsratp.js

Map to :
Host : tags/123.com
path : 123/dev/bootsratp.js

Can you please help me?

EricLaw

unread,
Aug 21, 2014, 5:08:40 PM8/21/14
to
Rather than piling on an unrelated question, next time please add a new thread with your question in it.

There are many ways to do this. The simplest is to use the AutoResponder to rewrite your URLs. See the end of this post for details:

I don't know what "tags/123.com" is supposed to be, since it's not a hostname. From the Fiddler Book:

Using RegEx Replacements in Action Text

Fiddler’s AutoResponder permits you to use regular expression group replacements to map text from the Match Condition into the Action Text. For instance, the rule:

Match Text

Action Text

REGEX:.+/123/(.*)

http://example.com/123/dev/$1

…will map a request for http://example.com/123/Test1.gif to http://example.com‌/123/dev/Test1.gif.


Reply all
Reply to author
Forward
0 new messages