October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

Rate Limiting Shared Networks: Count Licences, Not Just IP Addresses

A shared IP can represent many customers. See how licence-keyed rate limits and endpoint-specific namespaces prevent one user’s requests from consuming another’s allowance.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When people in a student house share one internet connection, an IP-based rate limit can treat their separate accounts as one caller. In Daniel Pertu’s Notifio example, the application instead keys notification limits to each customer’s licence token, so one buyer’s activity does not consume another’s allowance. That approach fits a licence-based notification endpoint; the right key depends on which identity or resource the limit is meant to protect.

Why an IP address can combine unrelated customers

An IP address identifies the network address a server sees, not necessarily the person or account making a request. A home router, university network, residence, office, or coworking gateway can send requests from many people through one public address. If a limiter counts only by IP, those people may share one bucket even when each has a separate licence.

As an Amazon Associate I earn from qualifying purchases.

Pertu illustrates this with six people in a student house: a limit set for one person’s expected activity could be exhausted by the household’s combined requests. The six-person scenario is an example, not a measured study. The underlying design issue applies whenever a network address is shared.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose the rate-limit key that matches what you are protecting

Key What it represents Trade-off
IP address The network address observed by the server Useful when limiting traffic by source network, but shared NAT can combine different customers in one bucket.
Licence token An application-level customer identity in Pertu’s design Separates licensed customers behind one NAT, but requests without a token still need a bounded path.

Pertu’s advice is: “Rate limit the identity you are actually protecting.” It is the author’s design guidance, not a standards-body rule. An IP-based limit can still be useful for bounding unauthenticated traffic or abuse by source network; it need not be the only limiter.

Keep endpoint budgets separate with a key namespace

In the described implementation, `/api/notify` and `/api/validate` use the same Redis-backed limiter instance, but the notification route adds a `notify:` prefix to its key. This keeps notification traffic in a separate key namespace: frequent validation requests cannot consume the notification bucket merely because both routes use the same limiter.

The route forms its key as notify:${token || ip}. When a token is present, the token identifies the notification bucket; when it is absent, the first forwarded IP value is used as a fallback. The endpoint rejects a missing or invalid licence later, but the fallback ensures tokenless requests still encounter a bounded bucket rather than collecting in one unlimited bucket.

The example is configured for a sliding window of 20 requests per 10 seconds. That is Pertu’s code example, not a universal threshold or a performance measurement. Set a quota according to the resource, expected legitimate use, and abuse risk in your own application.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Validate requests and return useful failure signals

Pertu describes one `/api/notify` route with a `type` field for four notifications: new listings, authentication failures, blocked sites, and reply confirmations. Before sending an email, the route checks the licence, its email match and active state, and the payload’s shape.

The described response contract assigns distinct HTTP statuses to different outcomes:

  • 400: malformed payload.
  • 403: missing, mismatched, or inactive licence information. The route uses the same message for these cases rather than revealing which credential detail was valid.
  • 429: the request has exceeded its rate limit.
  • 502: email delivery failed.

These distinctions give a client actionable signals, which matters when the installed application cannot be updated quickly. The author’s stated principle is: “Never return success for work you did not do.” In this example, the desktop application updates its “already seen” baseline only after an alert is delivered; falsely reporting success could suppress a later notification.

Handle listing content as untrusted text

Listing titles and URLs originate outside the notification service, so Pertu escapes them before inserting them into HTML email. The implementation also provides a plain-text counterpart for each email type. These steps help prevent third-party text from being interpreted as HTML and ensure the message is not available only in HTML form.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When a licence-keyed limiter is the right fit

A per-licence bucket is a sensible fit when the allowance is intended to apply to each licensed customer, as in Pertu’s notification example. It is not a substitute for deciding which resources need protection: a service may want a customer-level quota for normal use and a separate IP- or network-level control for unauthenticated traffic or abuse. Choose the key and namespace deliberately, then ensure every request path—including requests with no valid identity—has an appropriate limit.

Implementation details above describe Daniel Pertu’s Notifio article, “A student house is one IP address, so our rate limit counts licences”: DEV Community.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.