Proxy API requests
This article explains how to set up a server to proxy requests to ChainPatrol.
Why proxy requests?
There are two main benefits of using a proxy server to route requests to ChainPatrol:
-
Prevent leaking your API key - You can proxy requests to ChainPatrol through your own server which adds the ChainPatrol API key to each requests only on the server. This way, your API key is never exposed to the public.
-
Protect your user’s privacy - By proxying requests through your own server, ChainPatrol servers will not be able to read the IP addresses of your users if you are using the
/asset/check
API. This is because the requests to ChainPatrol will originate from your server and not from your user’s browser.
How to proxy requests
You can proxy requests to ChainPatrol using any server-side technology. Below are some examples of how to proxy requests using different technologies.
The provided examples are just a starting point and do not include any error handling, rate limiting, or request whitelisting. You should implement these features to ensure that your proxy server is secure and reliable.
Important Considerations
-
When deploying your proxy server, consider the ingress and egress volume that you’ll handle from your clients. If you’re expecting a lot of traffic, you may want to consider using a serverless platform like Cloudflare Workers or Deno Deploy to reduce costs.
-
Try to keep your proxy server as close to your clients as possible. This will reduce latency and improve performance.
-
When deploying your proxy server, make sure to use HTTPS. This will ensure that your requests are encrypted and secure.
-
We reserve the right to block/rate-limit your API key if we detect excessive usage or abuse. Please make sure to handle errors gracefully in the event of unexpected downtime and let us know when you are planning on going live with your integration, so that we can provision the appropriate resources to meet your demand. If you have any questions, please contact us at [email protected].
Was this page helpful?