{"id":804,"date":"2016-09-28T20:25:12","date_gmt":"2016-09-28T20:25:12","guid":{"rendered":"http:\/\/tpodolak.com\/blog\/?p=804"},"modified":"2016-09-28T20:25:12","modified_gmt":"2016-09-28T20:25:12","slug":"fiddler-redirecting-outgoing-calls-local-server","status":"publish","type":"post","link":"https:\/\/tpodolak.com\/blog\/2016\/09\/28\/fiddler-redirecting-outgoing-calls-local-server\/","title":{"rendered":"Fiddler &#8211; request redirection"},"content":{"rendered":"<p>As a back-end developer I am quite often contacted by front-end devs to take a look why certain <i>UI<\/i> calls to the server results in wrong data being returned by <i>API<\/i>. Usually I am provided with request payload so it is quite straightforward to reply it with <i>Postman<\/i> or <i>Fiddler<\/i> and see what is going on the backend. However for time to time, replying single request is not enough to reproduce the problem. In that case it is easier to just recreate the scenario on the <i>UI<\/i> and debug the <i>API<\/i> during that process. Unfortunately this approach requires backend devs to have <i>UI<\/i> up and running on their local machines and that is not always possible (e.g. you might not get access to <i>UI<\/i> repository). Fortunately with <i>Fiddler<\/i> it is quite easy to intercept outgoing front-end calls to the <i>API<\/i> and redirect them to your locally deployed version (so you can easily debug the <i>API<\/i>).<br \/>\nLet&#8217;s assume we would like to redirect all <i>simpletestspa.azurewebsites.net<\/i> calls <i>to localhost:50277<\/i>. In order to do that run <i>Fiddler<\/i> and go to <i>Tools -> Hosts\u2026<\/i><br \/>\n<a href=\"http:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/09\/fiddler-redirecting-outgoing-calls-to-local-server\/Toolsv2.png\" rel=\"attachment wp-att-806\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/09\/fiddler-redirecting-outgoing-calls-to-local-server\/Toolsv2.png\" alt=\"Fiddler - tools\" width=\"528\" height=\"363\" class=\"aligncenter size-full wp-image-806\" srcset=\"https:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/09\/fiddler-redirecting-outgoing-calls-to-local-server\/Toolsv2.png 528w, https:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/09\/fiddler-redirecting-outgoing-calls-to-local-server\/Toolsv2-150x103.png 150w, https:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/09\/fiddler-redirecting-outgoing-calls-to-local-server\/Toolsv2-300x206.png 300w\" sizes=\"auto, (max-width: 528px) 100vw, 528px\" \/><\/a><br \/>\nSelect &#8220;<i>Enable remapping of requests for one host to a different host or IP, overriding DNS<\/i>&#8221; checkbox<br \/>\n<a href=\"http:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/09\/fiddler-redirecting-outgoing-calls-to-local-server\/HostsWindow.png\" rel=\"attachment wp-att-805\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/09\/fiddler-redirecting-outgoing-calls-to-local-server\/HostsWindow.png\" alt=\"Fiddler - hosts window\" width=\"625\" height=\"334\" class=\"aligncenter size-full wp-image-805\" srcset=\"https:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/09\/fiddler-redirecting-outgoing-calls-to-local-server\/HostsWindow.png 625w, https:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/09\/fiddler-redirecting-outgoing-calls-to-local-server\/HostsWindow-150x80.png 150w, https:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/09\/fiddler-redirecting-outgoing-calls-to-local-server\/HostsWindow-300x160.png 300w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/a><br \/>\nand enter following values in the editor<\/p>\n<pre lang=\"bash\">\r\nlocalhost:50277 simpletestspa.azurewebsites.net\r\n<\/pre>\n<p>From now every outgoing request to <i>simpletestspa.azurewebsites.net<\/i> will be redirected to your local instance of the server on <i>localhost:50277<\/i>. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>As a back-end developer I am quite often contacted by front-end devs to take a look why certain UI calls to the server results in wrong data being returned by API. Usually I am provided with request payload so it is quite straightforward to reply it with Postman or Fiddler and see what is going [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[305],"tags":[306],"class_list":["post-804","post","type-post","status-publish","format-standard","hentry","category-fiddler","tag-fiddler"],"_links":{"self":[{"href":"https:\/\/tpodolak.com\/blog\/wp-json\/wp\/v2\/posts\/804","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tpodolak.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tpodolak.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tpodolak.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tpodolak.com\/blog\/wp-json\/wp\/v2\/comments?post=804"}],"version-history":[{"count":7,"href":"https:\/\/tpodolak.com\/blog\/wp-json\/wp\/v2\/posts\/804\/revisions"}],"predecessor-version":[{"id":813,"href":"https:\/\/tpodolak.com\/blog\/wp-json\/wp\/v2\/posts\/804\/revisions\/813"}],"wp:attachment":[{"href":"https:\/\/tpodolak.com\/blog\/wp-json\/wp\/v2\/media?parent=804"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tpodolak.com\/blog\/wp-json\/wp\/v2\/categories?post=804"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tpodolak.com\/blog\/wp-json\/wp\/v2\/tags?post=804"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}