-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert addition of rack-cloudflare gem (#1916)
The addition of cloudflare.rb is causing deployment issues to QA
- Loading branch information
Showing
5 changed files
with
7 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,32 +30,4 @@ class ThrottlingTest < ActionDispatch::IntegrationTest | |
assert_response :forbidden | ||
end | ||
end | ||
|
||
test "should handle requests via Cloudflare correctly in production" do | ||
original_env = Rails.env | ||
Rails.env = 'production' | ||
|
||
stub_configs({ 'api_rate_limit' => 3, 'login_block_limit' => 2 }) do | ||
# Test throttling for /api/graphql via Cloudflare | ||
3.times do | ||
post api_graphql_path, headers: { 'CF-Connecting-IP' => '1.2.3.4' } | ||
assert_response :unauthorized | ||
end | ||
|
||
post api_graphql_path, headers: { 'CF-Connecting-IP' => '1.2.3.4' } | ||
assert_response :too_many_requests | ||
|
||
# Test blocking for /api/users/sign_in via Cloudflare | ||
user_params = { api_user: { email: '[email protected]', password: random_complex_password } } | ||
|
||
2.times do | ||
post api_user_session_path, params: user_params, as: :json, headers: { 'CF-Connecting-IP' => '1.2.3.4' } | ||
end | ||
|
||
post api_user_session_path, params: user_params, as: :json, headers: { 'CF-Connecting-IP' => '1.2.3.4' } | ||
assert_response :forbidden | ||
end | ||
|
||
Rails.env = original_env | ||
end | ||
end |