Frontend vs Backend Proxying for Sanity API Requests

2 repliesLast updated: Nov 29, 2025

Hello, my team is evaluating Sanity as a possible headless CMS API provider. We have a several FE applications (one where an adminstrator would configure content, one where the end user would see the content, and then a backend API service. My question is - is it recommended that FE requests for content be proxied through our backend service to Sanity or just query the Sanity API directly from the FE?
AI Update

Based on Sanity's architecture and best practices, I recommend querying the Sanity API directly from your frontend for most use cases, with some important security considerations.

Sanity is designed for direct frontend queries and provides several features that make this the optimal approach:

1. API CDN for Performance Sanity's API CDN provides unlimited rate limits for cached content and global distribution. This means your frontend can query Sanity directly without hitting rate limits or experiencing latency issues.

2. Public Datasets For content that end users should see, you can configure your dataset as public, which allows anyone to query it without authentication. This is perfect for typical CMS use cases where you're serving published content to visitors.

3. CORS Support Sanity has built-in CORS configuration that you manage through the Sanity dashboard (Settings > API > CORS Origins). You can whitelist your frontend domains to allow direct browser requests.

Security Best Practices

The key is understanding when and how to use authentication tokens:

For Read-Only Public Content:

For Private/Draft Content (like your admin app):

For Write Operations:

Your Architecture

For your specific setup:

When to Use a Proxy

You should proxy requests through your backend when:

Key Takeaway

The beauty of Sanity's architecture is that you can mix approaches—direct queries for public content (leveraging the CDN for performance) and proxied requests for sensitive operations. This gives you both performance and security. For most read operations, going direct to Sanity is the recommended pattern and will give you the best performance through their global CDN.

Show original thread
2 replies

Was this answer helpful?

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Related contributions