TL;DR: svelte backend (cloudflare) is sitting in front of the GCP API therefore it is not possible to do IP based rate limiting in sanic. Instead, we must implement it in svelte for now.
In production environment, I have set cookie rate limit to be 5 requests per minute, and IP based rate limit to be 100 per day using cloudflare's environment varables
Technical Changes
Add sveltekit-rate-limiter
Revert the old PR that caused the rate limit issue (where all requests are misinterpreted as the same IP)
Tests
Setup:
In Cloudflare, I have set the dev environment to temporarily have these environment varaibles
Test cookie rate limiter. This should trigger after 5 requests using the same browser
Using incognito, we can continue to send requests without being blocked. But after 5 more requests we hit our IP based rate limit
Now, just to be safe, I used a different computer with VPN and reconnected to the same dev website. And confirmed that I can continue to send additional requests
Description
Technical Changes
Tests
Setup:
https://github.com/astronomer/ask-astro/assets/26350341/0431cae3-b38d-479c-9b87-b1e7667286bd
Using incognito, we can continue to send requests without being blocked. But after 5 more requests we hit our IP based rate limit
Now, just to be safe, I used a different computer with VPN and reconnected to the same dev website. And confirmed that I can continue to send additional requests
closes #268