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
use rate limiting
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.
rate limiting to do what
to limit the user request to send the webhook
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
well it's simple don't put the webhook in the front end
how would I put it on the backend if im using pages to host the static website?
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
okay thanks