Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: gateway use cf dns to prevent rate limit instead of durable object #36

Merged

Conversation

vasco-santos
Copy link
Contributor

@vasco-santos vasco-santos commented Apr 18, 2022

Per Cloudflare durable limits that lead to temporary fix on #32 , this PR adds solution proposed in #17 by replacing Durable Object logic to prevent rate limits by a DNS based solution that enables us to rely on CF dashboard to stipulate rate limits.

Added rate limit rule https://dash.cloudflare.com/fffa4b4363a7e5250af8357087263b3a/nftstorage.link/security/waf/rate-limiting-rules pinata.nftstorage.link by X-Forwarded-For. Internally within the worker, we track 429 errors already and wey will be counted in metrics.

TODO:

  • Add domain to CF nftstorage.link zone
  • Setup rate limits to pinata.nftstorage.link

Closes #17

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Apr 18, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 50af45c
Status: ✅  Deploy successful!
Preview URL: https://98643b17.nftstorage-link.pages.dev

View logs

@vasco-santos
Copy link
Contributor Author

Note: there is currently an error "CNAME cross-user banned". This error happens when we attempt to CNAME to a Cloudflare proxied site. We will need to talk with Pinata to have our domain whitelisted

@vasco-santos vasco-santos marked this pull request as ready for review April 25, 2022 08:55
@vasco-santos
Copy link
Contributor Author

Note: there is currently an error "CNAME cross-user banned". This error happens when we attempt to CNAME to a Cloudflare proxied site. We will need to talk with Pinata to have our domain whitelisted

This was arranged with Pinata team and we are now live 🎉 https://pinata.nftstorage.link/ipfs/bafybeiegsdpbk5bs73mtsj2cduyaq3hddra5c33t6vw2vcctxhhxmsd46u

packages/edge-gateway/wrangler.toml Outdated Show resolved Hide resolved
Co-authored-by: Oli Evans <oli.evans@gmail.com>
@vasco-santos vasco-santos requested a review from olizilla April 25, 2022 09:33
Copy link

@alanshaw alanshaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vasco-santos vasco-santos merged commit f192d70 into main Apr 25, 2022
@vasco-santos vasco-santos deleted the fix/gateway-use-cf-dns-to-prevent-rate-limit-instead-of-do branch April 25, 2022 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace gateway Durable Object for Rate Limit Prevention
3 participants