Cloudflare to send post requests to webhook

I have a webpage that is static, but I'd like to be able to take the users query params and send it to a discord webhook. I know I can send a request to the webhook on the frontend with js, but that gives the user access to the webhook, where they can spam it. I was wondering if there was a way to do it somehow on the backend with cloudflare, or if there is a way to secure the webhook and have it on the frontend I'm unaware of. Thanks!
9 Replies
yat
yat2y ago
use rate limiting
yat
yat2y ago
Rate limiting rules · Cloudflare Web Application Firewall (WAF) docs
Rate limiting rules allow you to define rate limits for requests matching an expression, and the action to perform when those rate limits are reached.
fugdick
fugdickOP2y ago
rate limiting to do what
yat
yat2y ago
to limit the user request to send the webhook
fugdick
fugdickOP2y ago
the goal is that the user can't get the webhook, my mention of them spamming it is just an example of a reason why I don't want them to have it
yat
yat2y ago
well it's simple don't put the webhook in the front end
fugdick
fugdickOP2y ago
how would I put it on the backend if im using pages to host the static website?
yat
yat2y ago
u can't u need a backend u can then make an API route or something using a worker this will not expose ur webhook token
fugdick
fugdickOP2y ago
okay thanks

Did you find this page helpful?