README.md in nexaas-throttle-2.0.1 vs README.md in nexaas-throttle-2.0.2
- old
+ new
@@ -40,10 +40,11 @@
port: 6379,
db: 0,
namespace: "nexaas:throttle"
}
config.ignored_user_agents = [/[Gg]oogle/, /Amazon/]
+ config.assets_extensions = %w[bmp tiff css js jpg jpeg png gif woff ttf svg]
end
```
### Configuration
@@ -95,10 +96,15 @@
<tr>
<td><code>ignored_user_agents</code></td>
<td>An array of User Agents that should be ignored by the throttler. Values are regexes that will be matched against the request User-Agent</td>
<td><code>nil</code></td>
</tr>
+ <tr>
+ <td><code>assets_extensions</code></td>
+ <td>An array of file extensions considered to be asset-related. Values are strings that will be matched against the request path. Paths that match will be not be throttled</td>
+ <td><code>%w[css js jpg jpeg png gif woff ttf svg]</code></td>
+ </tr>
</table>
### Request Identification
`Nexaas::Throttle` doesn't know how to identify a consumer. Some applications might rely on request IP, others on an API TOKEN. You must provide a way of getting an unique token
@@ -136,9 +142,19 @@
end
end
```
If you want, you can access the request token by inspecting `request.env["nexaas.token"]`. This is the token your `request_identifier` provided after evaluating the request.
+
+### Response headers
+
+Rate limit headers are available for all request responses and provide information for API users. They are the following:
+
+```ruby
+"X-RateLimit-Limit" # Total of requests allowed until next reset.
+"X-RateLimit-Remaining" # Amount of requests the user can still send before being throttled.
+"X-RateLimit-Reset" # Epoch time for the reset of the request count.
+```
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.