api: add rate limit to /explore/posts/popular.json endpoint.
Add a rate limit of 1 request per minute to the /explore/posts/popular.json endpoint. This is to deal with a particular bot checking this page multiple times per second.
This commit is contained in:
@@ -2,6 +2,8 @@ module Explore
|
||||
class PostsController < ApplicationController
|
||||
respond_to :html, :xml, :json
|
||||
|
||||
rate_limit :popular, rate: 1.0/1.minute, burst: 50, if: -> { request.format.json? }, key: "explore:popular.json"
|
||||
|
||||
def popular
|
||||
@date, @scale, @min_date, @max_date = parse_date(params)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user