Project

General

Profile

Redirecting all requests at :8080/announce?<randomhash> to be sent to the same address, but on port 8080.

Added by Harry over 14 years ago

spaam on IRC helped me, he got it fixed with:

url.redirect = ("^/announce(.*)" => "http://domian.tld:8080/annouce$1")

Thanks! (do not need to reply :))

Basically, I am running a BitTorrent tracker. It is configured to accept ANNOUNCE requests on port 8080, lighttpd listening on port 80. Stupid people often use port 80 for the tracker, instead of 8080, making my logs get filled with 404 requests, and them thinking that my site is broken (though they were the only ones who did something incorrectly). I tried to use code like this, but with no luck.

$HTTP["scheme"] == "http" {
url.redirect = ("^/(announce*)" => "http://my.website:8080/announce?$-")
}

Here is what the logs say when they mess up (WITHOUT the broken 'fix' enabled):

ip.address.here my.website [05/Oct/2009:20:26:41 0400] "GET /announce?info_hash=%F6%2B%15%181%13%A6%08%B2%EEP%D4%14%A4%F2%D%88%A1c%15&peer_id=-TR1510-u7dz0rujdgzr&port=51413&uploaded=0&downloaded=0&corrupt=0&left=8042999&compact=1&numwant=200&key=tnn1fg2pyd&event=started HTTP/1.1" 404 345 "-"

Here is the log with my broken fix enabled:

ip.addr my.website [05/Oct/2009:20:24:39 0400] "GET /announce?info_hash=%F6%2B%15%181%13%A6%08%B2%EEP%D4%14%A4%F2%D%88%A1c%15&peer_id=-TR1510-bwv6t0p5vfxy&port=51413&uploaded=0&downloaded=0&corrupt=0&left=8042999&compact=1&numwant=200key=9c7yu79hzn&event=started HTTP/1.1" 301 0 "-"
ip.addr my.website [05/Oct/2009:20:24:39 0400] "GET /tracker/ HTTP/1.1" 200 2307 "-"

/tracker/ is a legit file on port 80, but that is NOT what I want. My tracker software 301's -> /tracker/ if the request at port 8080 was not correct. So I must be messing up on lighttpd grabbing the correct announce parms?

Yes, I did read the docs for a while, I just do not understand how I would transfer the port, while keeping the request parm the same. Please help me :)