caddy-ext icon indicating copy to clipboard operation
caddy-ext copied to clipboard

rate_limit does not trigger

Open UltraBlackLinux opened this issue 1 year ago • 5 comments

Hey there, I'm trying to protect a basicauth prompt against brute-forcing using rate_limit, but for some reason it just does not trigger. I can curl the path all day long and it will not even once return a 429. Here's my config:

handle_path /test {
  rate_limit {query.id} 1r/m
  basicauth {
    something something
  }
  reverse_proxy ...
 }

any idea why?

UltraBlackLinux avatar Mar 07 '24 14:03 UltraBlackLinux

same problem, did you find a solution?

Hor1kon avatar Jul 03 '24 22:07 Hor1kon

@Hor1kon I switched to this: https://github.com/mholt/caddy-ratelimit it's working fine

UltraBlackLinux avatar Jul 04 '24 21:07 UltraBlackLinux

@Hor1kon This is working for me

    handle /login {
        rate_limit {remote.host} 10r/m
        reverse_proxy my-app:3000 {
            header_up X-Real-IP {remote_host}
        }
    }

I had to add an order block at the top of my Caddy file

{
	order rate_limit before basicauth
}

Also, make sure that the network request that you are trying to block actually matches the path that you have in your handle.

decaf-dev avatar Jul 04 '24 22:07 decaf-dev

@Hor1kon I switched to this: https://github.com/mholt/caddy-ratelimit it's working fine

Yea, I also have switched to it

Hor1kon avatar Jul 05 '24 05:07 Hor1kon

@Hor1kon This is working for me

    handle /login {
        rate_limit {remote.host} 10r/m
        reverse_proxy my-app:3000 {
            header_up X-Real-IP {remote_host}
        }
    }

I had to add an order block at the top of my Caddy file

{
	order rate_limit before basicauth
}

Also, make sure that the network request that you are trying to block actually matches the path that you have in your handle.

Yeah, I think by me it wasn't working because of this first line, because in other rate-limit build this line was initially in the example

Hor1kon avatar Jul 05 '24 05:07 Hor1kon