title: Proxy servers resolve requests to themselves
body: <p>I am trying to make some HTTP request using a HTTP proxy server over Tor. So far, I have experimented with Privoxy, Tinyproxy and Polipo. But whenever I make a request through any of these proxy servers, they somehow fetch themselves, and get stuck in a loop. </p>
  
  <p>To check if there is any problem with DNS or network, I tried to fetch URLs without proxy and it works fine. I am using Ubuntu 12.04 64bit servers, and using python with requests module to test the setup.</p>
  
  <p>Moreover, I am experiencing this problem on a server with two static IPv4 Addresses, on a server with one static IPv4 address, it works fine. I tried to simulate this on an EC2 server, there also it works on server with Elastic IP address, but on the one without Elastic IP Address, I experience the same problem.</p>
  
  <p>I tried to dig deeper by editing the source code of Tinyproxy to see why the error happens, and its because the proxy server thinks the "Host" is 127.0.0.1 for the request. If I specify "Host" in the request headers, then it works somewhat fine. But that isn't normal behaviour.</p>
  
  <p>If, it could have been only a single Proxy server, then I could have thought of it as a software bug. But the problem is present with all of the proxy servers, and it makes me wonder if there is something wrong with network setup</p>
  
  <p>Here is how I am trying to make request</p>
  
  <pre><code>import requests
  # tinyproxy listens on Port 8888
  r = requests.get("http://google.com", proxies={'http': '127.0.0.1:8888'}) 
  </code></pre>
  
  <p>And I get the following response</p>
  
  <pre><code> 400 Bad Request &lt;p&gt;You tried to connect to the machine the proxy is running on &lt;/p&gt;
  </code></pre>