How to use rate_limit

i want to use rate_limit module.

but caddyFile doesn’t recognise it.

in order to use do I have to install caddy using xcaddy first? currently caddy is installed using ubuntu package.


Which rate_limit module? This one?

There are instructions and very clear examples on the readme. Please give it a read and let us know where you are stuck.

yeah i tried both.

the issue is that I already installed caddy using ubuntu package, when I try with:
xcaddy build --with GitHub - mholt/caddy-ratelimit: HTTP rate limiting module for Caddy 2

and use it it in Caddyfile, it complains on rate_limit being unknown.

so the question is, shall I uninstall caddy ubuntu package and re-install it with xcaddy?

or is there a way around.


You’re probably not running the binary you think you are. xcaddy build creates a binary in the current directory, not whatever $(which caddy) is. Make sure you’re running the correct binary.

Yes, i think that’s the reason.

So what you are saying is, I can’t use rate_limit with the caddy that I installed using the ubuntu package?

if that is the case then, do I have to stop that one, and install and run caddy using xcaddy?

You can use your custom build; just follow the link at the end of the section you were reading:

And it has instructions for using a custom binary with your Ubuntu installation.

This topic was automatically closed after 30 days. New replies are no longer allowed.