Proxying Bittorrent

Michael Baudino michael.baudino at acrelec.com
Tue Sep 22 21:57:31 MSD 2009


Hello,

I'm trying to proxy BitTorrent tracker traffic through nginx (0.6.32)
using the following configuration :
                                 __________
+--------+    +-----------+     (          )     +------------+
| BT Box |----| Nginx Box |----(  Internet  )----| BT tracker |
+--------+    +-----------+     (__________)     +------------+


My BitTorrent Box can access all other peers, but that's not the point here.

The point here is to proxy traffic from the BT Box to the tracker (which
is HTTP :
http://wiki.theory.org/BitTorrentSpecification#Tracker_HTTP.2FHTTPS_Protocol).

I'm using the /etc/hosts file on the BT Box to override
tracker.openbittorrent.com name resolution and make it resolve to
10.73.0.14 (the Nginx Box address).

BT Box only receives 502 Bad Gateway responses from the Nginx Box with
the following config :

server {
        listen 10.73.0.14:80;
        server_name  tracker.openbittorrent.com;

        access_log  /var/log/nginx/bt_access.log main;
        error_log   /var/log/nginx/bt_error.log debug;

        location / {
                proxy_set_header  X-Real-IP  $remote_addr;
                proxy_pass      http://$host$request_uri;
        }
}


While it's receiving a good 200 response if I use one of the IP
addresses of the tracker instead of $host :

                proxy_pass      http://188.126.64.3$request_uri;


I could just go for it but the problems are :
- it does not use the tracker's DNS load-balancing system
- i cannot include other trackers in the server_name directive

So here is my question (finally !) :
- is it normal that proxy_pass'ing to $host returns a 502 Bad Gateway ?
- is there any other way to do what i want ?

Thanks in advance.

-- 
Mike
KameHouse Prod.






More information about the nginx mailing list