Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
171 views
in Technique[技术] by (71.8m points)

Why does discord keep sending requests to my server weirdly

I am doing a simple imaging service (related to a game called Transformice), which would listen to requests, then load and grab XML of "maps" from the game, generate the image and then serve that image to the client. This project is open sourced so you may find the code here

It works fine so far when I request an image from the browser, but when I tried to load the same thing in discord, it sends lots of requests to me in an unexpected way.

I did some loggings so it's easier to understand what's actually happening.

[INFO][SERVER|MAIN] GET /map/589352/preview <200> (User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36)
[INFO][SERVER|MAIN] GET /map/589352/preview <-> (User-Agent: Mozilla/5.0 (compatible; Discordbot/2.0; +https://discordapp.com))
[INFO][SERVER|MAIN] GET /map/999999/preview <200> (User-Agent: Mozilla/5.0 (compatible; Discordbot/2.0; +https://discordapp.com))
[INFO][SERVER|MAIN] GET /map/999999/preview <-> (User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0)
[INFO][SERVER|MAIN] GET /map/999999/preview <200> (User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0)

[INFO][SERVER|MAIN] GET /map/123455/preview <-> (User-Agent: Mozilla/5.0 (compatible; Discordbot/2.0; +https://discordapp.com))
[INFO][SERVER|MAIN] GET /map/999999/preview <200> (User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0)
[INFO][SERVER|MAIN] GET /map/696969/preview <-> (User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0)
[INFO][SERVER|MAIN] GET /map/777777/preview <-> (User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0)
[INFO][SERVER|MAIN] GET /map/424242/preview <-> (User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0)
[INFO][SERVER|MAIN] GET /map/696969/preview <200> (User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0)
[INFO][SERVER|MAIN] GET /map/777777/preview <-> (User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0)
[INFO][SERVER|MAIN] GET /map/777777/preview <-> (User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0)
[INFO][SERVER|MAIN] GET /map/777777/preview <200> (User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0)
[INFO][SERVER|MAIN] GET /map/424242/preview <-> (User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0)
[INFO][SERVER|MAIN] GET /map/777777/preview <-> (User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0)
[INFO][SERVER|MAIN] GET /map/424242/preview <-> (User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0)
[INFO][SERVER|MAIN] GET /map/777777/preview <-> (User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0)
[INFO][SERVER|MAIN] GET /map/424242/preview <-> (User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0)
[INFO][SERVER|MAIN] GET /map/777777/preview <-> (User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0)
[INFO][SERVER|MAIN] GET /map/424242/preview <-> (User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0)
[INFO][SERVER|MAIN] GET /map/42069/preview <-> (User-Agent: Mozilla/5.0 (compatible; Discordbot/2.0; +https://discordapp.com))
[INFO][SERVER|MAIN] GET /map/777777/preview <-> (User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0)
[INFO][SERVER|MAIN] GET /map/424242/preview <-> (User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0)
[INFO][SERVER|MAIN] GET /map/777777/preview <-> (User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0)
[INFO][SERVER|MAIN] GET /map/424242/preview <-> (User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0)
[INFO][SERVER|MAIN] GET /map/69420/preview <-> (User-Agent: Mozilla/5.0 (compatible; Discordbot/2.0; +https://discordapp.com))
[INFO][SERVER|MAIN] GET /map/999999/preview <-> (User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0)

First I requested from browser (the first log) and it worked fine, after I tried to load the same thing in discord, few worked but then it kept doing this - requesting the same resource infinitely. Because of this there are some delays and sometimes it doesn't load the map at all.

What I wanted to know is the exact reason for this behaviour and a way to handle this kinds of stuff.

question from:https://stackoverflow.com/questions/65881370/why-does-discord-keep-sending-requests-to-my-server-weirdly

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...