Reputation: 6093
I'm trying to redirect all requests for my site to my localhost with port number. So I tried this:
if (oSession.host=="request.mysite.com") {
oSession.host="000.000.000.000:8080/MySite";
}
However, I'm getting this error message:
[Fiddler] HTTP Request specified an invalid port number.
I have Tomcat server, running Windows 8.1, and I connect to my localhost with 8080 port number. I also tried it this way:
if (oSession.HostnameIs=="request.mysite.com") {
oSession.hostname="000.000.000.000:8080/MySite";
}
In this case there was no error, but also no pointing to my localhost. I tried to use my machine name instead of the IP, tried to write localhost, but nothing worked as expected.
Another attempt was to use Host Remapping tool in Fiddler. I wrote this:
000.000.000.000:8080/MySite request.mysite.com
But got this error message when tried to save:
I don't know why none of this works... Any suggestions?
Upvotes: 2
Views: 2097
Reputation: 57085
You can't include a URLPath /MySite
in anything that expects a Host
; a Host, by definition, doesn't include the path.
If you need to inject a new path component, you can't use the Hosts extension and you must adjust your FiddlerScript to change the host and prepend the target string to the PathAndQuery
.
HostnameIs
is a method, not a property.
if (oSession.HostnameIs("request.mysite.com") &&
!oSession.HTTPMethodIs("CONNECT"))
{
oSession.host="0.0.0.0:8080";
oSession.PathAndQuery = "/MySite" + oSession.PathAndQuery;
}
Upvotes: 2