Skip to content

Commit

Permalink
fix: disable rate limiting for internal trafic (#11327)
Browse files Browse the repository at this point in the history
This is to whitelist internal users of product opener running on off1,
off2, ovh1/2/3 and moji.
  • Loading branch information
stephanegigandet authored Feb 6, 2025
1 parent 71c9dfa commit 17b9a54
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/ProductOpener/Config_off.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1623,7 +1623,9 @@ $options{rate_limit_product} = 100;

# Rate limit allow list
$options{rate_limit_allow_list} = {
'146.59.148.140' => 1, # OVH1
'51.210.154.203' => 1, # OVH2
'51.210.32.79' => 1, # OVH3
'45.147.209.254' => 1, # Moji server (actually OSM proxy, Moji only has ipv6)
};

Expand Down
6 changes: 6 additions & 0 deletions lib/ProductOpener/Routing.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,12 @@ sub set_rate_limit_attributes ($request_ref, $ip) {
$block_message
= "Rate-limiter blocking is disabled for local IP addresses, but the user has reached the rate-limit";
}
# Check that the ip is not in the OFF private network
elsif ($ip =~ /^10\.1\./) {
# The IP address is in the OFF private network, we don't block the request
$block_message
= "Rate-limiter blocking is disabled for the OFF private network, but the user has reached the rate-limit";
}
# Check that the IP address is not in the allow list
elsif (defined $options{rate_limit_allow_list}{$ip}) {
# The IP address is in the allow list, we don't block the request
Expand Down

0 comments on commit 17b9a54

Please sign in to comment.