Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check request format is not working anymore #12

Closed
lazaronixon opened this issue Jun 22, 2022 · 1 comment
Closed

Check request format is not working anymore #12

lazaronixon opened this issue Jun 22, 2022 · 1 comment

Comments

@lazaronixon
Copy link

lazaronixon commented Jun 22, 2022

If I use the condition together with ActionDispatch::Request.new(env).format the request become a */* and some headers are deleted. It works if I set the Accept header, but not with only the url extension

  config.middleware.use(
    Rack::Ratelimit, name: "API", conditions: -> (env) { ActionDispatch::Request.new(env).format.json? }, rate: [50, 10.seconds], redis: Redis.new, logger: Rails.logger
  ) { |env| ActionDispatch::Request.new(env).ip }
@lazaronixon
Copy link
Author

My bad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant