Last active
July 15, 2020 21:58
-
-
Save christianoguedes/d26af06f4513c4ffe603a067a6734f02 to your computer and use it in GitHub Desktop.
hazelcast default configuration rate limit
This file contains hidden or 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
| #bloqueio para todos os endpoints, exceto do 'actuator' | |
| bucket4j.filters[0].cache-name=rate-limit #nome do cache no hazelcast.xml | |
| bucket4j.filters[0].http-response-body={ "message": "Too many requests" } #payload de retorno padrao em caso de exceder o limit | |
| bucket4j.filters[0].url=.* #regex para todas as URIs dos endpoints | |
| bucket4j.filters[0].rate-limits[0].skip-condition=getRequestURI().contains('/actuator') #exemplo de uma excessao que nao se aplica o rate-limit. A sintaxe é o SpEl - Spring Expression Language | |
| bucket4j.filters[0].rate-limits[0].expression=getRemoteAddr() #a expressão utilizada para gerar a chave do cliente. Neste caso o IP | |
| bucket4j.filters[0].rate-limits[0].bandwidths[0].capacity=5 #a capacidade máxima de requisições | |
| bucket4j.filters[0].rate-limits[0].bandwidths[0].time=1 #quantidade de tempo para análise do rate-limit | |
| bucket4j.filters[0].rate-limits[0].bandwidths[0].unit=minutes #intervalo de tempo (ChronoUnit) da análise | |
| bucket4j.filters[0].rate-limits[0].bandwidths[0].fixed-refill-interval=1 #tempo de bloqueio | |
| bucket4j.filters[0].rate-limits[0].bandwidths[0].fixed-refill-interval-unit=minutes #unidade de tempo do bloqueio |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment