• 0

How to rate limit a web server?


Question

I've noticed whenever I hit too many links on LinkedIn, it gives me an HTTP 429 error.  Apparently this is their version of a rate limit notice.

It's rather interesting and I would like to do similar things on my own server. I have a basic Apache Web server at home and I'm wondering how I could configure it to perform a rate limit. I guess the operating system or Apache would have to identify the individual and not can convoluted with other peoples traffic and then once they've access too many pages in a given amount of time, a generic HTML page is presented rather than the dynamic PHP content.

 

Any advice would be appreciated. I'm not really sure where to start looking for this stuff. I don't think this is done at the PHP level. I suspect it's done at the Apache of operating system level. Even at the firewall level.

Link to comment
https://www.neowin.net/forum/topic/1435050-how-to-rate-limit-a-web-server/
Share on other sites

5 answers to this question

Recommended Posts

  • 0

You’re looking for an apache mod. There are numerous available, a quick Google search brought up plenty of information - but I’m assuming you want more than that, you’d prefer a user here to give their own recommendations :)

You are spot on about this occurring WAY before you get to languages such as PHP, you want this to be implemented when they request is first received.

  • 0

I think so Barrett but I don't really understand how it works. Based on what I'm experiencing, I think either Apache or the operating system is intercepting my connection. Either that or there's some intelligent firewall going on. I'm really fascinated by this technology. I guess LinkedIn gets hit hard every day and they need to rate limit all the users. Kind of lame considering they make so much money every day.

  • 0

You could configure Apache to limit connections with a module for example.

I have an Apache server which only purpose is to serve downloads for a website I run, however to stop bots crawling the site and scraping every file (putting immense load on the server) a module is used (limitipconn_module) that limits the max number of connections per IP address to two.

If someone attempts to download more than two files at once they are simply shown an error message. When one download has finished that person is free to start another download.

To do this you would edit your configuration file to load the module and configure the desired options:

# Limit to two Connections
LoadModule limitipconn_module modules/mod_limitipconn.so
<IfModule limitipconn_module>
MaxConnPerIP 2
</IfModule>

This could potentially be an issue if two users we're behind a CGNAT on the same ISP and therefor shared the same WAN IP address, however my site is no LinkedIn so that's very unlikely to happen. However I thought it was worth brining up a potential limitation of doing that.

You can also increase / decrease the request per second on Apache: https://ubiq.co/tech-blog/increase-apache-requests-per-second/

LinkedIn will be load balancing the traffic, using a Web Application Firewall (WAF) to analyse traffic and then either allow or deny it, probably a whole lot more also.

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Playground Games confirms Forza Horizon 6 save wipe bug by Taras Buria Forza Horizon 6 was launched last month to critical acclaim (check out our review here), and it became a smash hit in an instant. Now, weeks into the launch, with die-hard fans clocking hundreds of hours, Forza Horizon 6 is facing a serious issue: save wipes. After multiple complaints on Reddit and social media, the studio issued a statement. The problem with missing saves came shortly after Playground Games promised the initial batch of gameplay tweaks and improvements. Unfortunately, there seems to be no temporary fixes for those affected by unexpected save wipes. However, the studio published a new support document with a few important steps users should try. First, affected gamers should open a support ticket immediately (go here to file one) so that the support team can try recovering the lost progress by reverting to an earlier save. Playground Games says this should be done the same day the issue occurs. Meanwhile, gamers are urged not to start new play sessions or create new saves. The studio also published a few things gamers should try to avoid to prevent potential progress loss: Ensure your Gaming Services app on PC or XBOX Series X|S console is fully up to date. On XBOX Series X|S consoles, disable Quick Resume for Forza Horizon 6: To disable Forza Horizon 6 from using Quick Resume, highlight the game box art anywhere in the console experience (Home, My Games & Apps, Pins, etc) and then press the Menu button, then go to Manage game and add-ons > Quick Resume settings > Disable Quick Resume. Ensure you are online when ‘quitting’ the game. Give your saved time to sync to the cloud before powering off or switching devices. Do not force quit the game during save screens. Do not power off the device during gameplay. Always "Quit" (console) or "Exit to desktop" (PC) once you've finished your play session, ensuring the save icon is not visible when you’re closing the game. Before turning off your console, shutting down your PC, or force-closing the Steam app, give your devices or clients at least a few minutes to ensure your latest progress has been synchronized with the cloud. This will reduce the risk of progress reversions as you switch between different platforms. XBOX Series X|S consoles, Steam, and the XBOX app on PC all include game save indicators that confirm your progress has been synced. You can read more about the bug in the official support document here. Forza Horizon 6 is currently available on PC (Steam and the Microsoft Store), Xbox Series X|S, and Game Pass. The game is also coming to PlayStation 5 later this year.
    • If only Windows would have a toggle switch labeled "Get the latest updates as soon as possible" inside Windows Update settings... But nah, let's hide the new stuff inside a controlled feature rollout, even if the user is explicitly asking for the new stuff as soon as possible. Awesome idea!
    • After watching the Apple event earlier this week it is quite the contrast. Apple is going back and tweaking the code to make things more efficient in many areas of MacOS. Windows is boosting your electric build to hide their issues.
  • Recent Achievements

    • One Year In
      slackerzz earned a badge
      One Year In
    • One Year In
      highriskpaym earned a badge
      One Year In
    • One Month Later
      highriskpaym earned a badge
      One Month Later
    • Week One Done
      highriskpaym earned a badge
      Week One Done
    • Week One Done
      FBSPL earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      502
    2. 2
      PsYcHoKiLLa
      199
    3. 3
      +Edouard
      157
    4. 4
      Steven P.
      84
    5. 5
      ATLien_0
      74
  • Tell a friend

    Love Neowin? Tell a friend!