Rate limiting is a traffic control mechanism used to regulate the number of requests a client can make to a server within a defined time window. It plays a critical role in protecting web applications, APIs, and backend infrastructure from abuse, excessive usage, and denial of service attempts.
When properly implemented, rate limiting ensures fair usage of system resources and prevents a single user or bot from overwhelming your application. However, simply configuring rate limits is not enough. You must also verify that they are correctly enforced.
This guide explains how to test rate limiting using curl and how to confirm whether your configuration is functioning as expected.
Note : These tests apply only to non cacheable content. If the endpoint is cached, requests may not reach the origin server and rate limiting may not trigger.
Rate limiting protects your platform in several ways:
Without proper rate limiting, even legitimate traffic spikes can cause performance degradation. Testing ensures that your configuration works under real world conditions
Replace: https://vergedge.lol → your target URL
This command sends 20 consecutive HTTP requests to the target endpoint as quickly as possible. It prints only the HTTP status code for each request.
If rate limiting is enabled and configured correctly, you should observe:
If all responses return 200, it may indicate:
This method simulates a burst of traffic from a single client and helps confirm whether request limits are enforced at the expected threshold.
Terminal screenshot
Replace : 1.2.3.4 → a fake IP address (random private/public IP)
https://vergedge.lol → your target URL
The command injects a custom X Forwarded For header to simulate requests coming from a different client IP address.
If your application blindly trusts the X Forwarded For header without proper validation, attackers may spoof IP addresses to bypass rate limits.
If rate limiting is implemented securely:
If spoofing successfully bypasses limits, you may need to:
This test helps verify whether enforcement is happening at the correct network layer.
Terminal Screenshot
Replace : "Mozilla/5.0 (Custom)" → any User-Agent string
https://vergedge.lol → your target URL
This command sends requests using a custom User Agent header.
Attackers often rotate User Agent strings to avoid detection. If rate limiting is tied only to User Agent instead of IP or session identifiers, it may be easier to bypass.
If rate limiting is IP based:
Changing the User Agent should not prevent 429 responses
If rate limiting is incorrectly configured:
This test confirms whether enforcement is based on robust identifiers.
Terminal Screenshot
During testing, pay attention to:
You can also introduce small delays between requests to simulate realistic usage patterns.
To ensure strong and secure enforcement:
Proper configuration should strike a balance between protection and usability. Limits that are too strict can block legitimate users. Limits that are too lenient may allow abuse.
Rate limiting is a critical security and performance control for APIs and web services. Testing with curl provides a simple yet effective way to verify whether your configuration is active and resilient.
During validation:
By performing these checks regularly, you can ensure that your application remains protected against abuse while maintaining a smooth user experience for legitimate users.