RealComposer
Frontend / WebSalesforceEdge Caching & Rate Limits

How to cache salesforce api responses at edge

Reduce Salesforce API daily limit usage

Direct Answer & Architecture Summary

Cache read-heavy Contact and Account queries with short TTL. For "how to cache salesforce api responses at edge", store SALESFORCE_ACCESS_TOKEN in Secret Vault, call https://{{secrets.SALESFORCE_INSTANCE}}.my.salesforce.com/services/data/v68.0/sobjects/Contact/{{query.contactId}} from a Worker, and let Frontend / Web hit only https://realcomposer.com/v1/workspace/cache-salesforce-api-at-edge with an rc_live_ client token. Enable 300s GET cache only when query params identify the resource.

Security LevelAES-256-GCM Vault
Edge LatencySub-10ms Response
InfrastructureZero Server Maintenance
The Problem Solved

Salesforce rate limits from Frontend / Web traffic

Without edge caching, identical Salesforce reads during a session still round-trip to the origin.

Critical Security & Operational Risks:
  • HTTP 429 responses during launch traffic
  • Surprise SaaS overages from duplicate reads
  • Slower repeat views than necessary
Architecture & Step-by-Step Implementation

How RealComposer Solves This at the Edge

1

Add vault secrets for this pipeline

Create SALESFORCE_ACCESS_TOKEN vault entries, then bind them to this pipeline step headers with {{secrets.NAME}} placeholders.

2

Set headers, mapping, and cache TTL

Configure headersTemplate to inject vault secrets, target https://{{secrets.SALESFORCE_INSTANCE}}.my.salesforce.com/services/data/v68.0/sobjects/Contact/{{query.contactId}}, and Add output mapping fields that mirror the JSON contract your screen already expects.

3

Call from Frontend / Web

Call https://realcomposer.com/v1/workspace/cache-salesforce-api-at-edge with a restricted rc_live_ client token. Frontend / Web never sends upstream secrets.

                    const res = await fetch('https://realcomposer.com/v1/workspace/cache-salesforce-api-at-edge', {
  headers: { Authorization: 'Bearer rc_live_your_token' }
});
                  
Payload Slimming Comparison
78% Bandwidth Reduction
Raw Upstream Response247 B
              {
  "requestId": "req_cache-sa",
  "upstreamLatencyMs": 142,
  "audit": {
    "region": "edge",
    "trace": "cache-salesforce-api-at-edge"
  },
  "payload": {
    "id": "sample_id",
    "status": "active",
    "nested": {
      "tags": [
        "demo"
      ],
      "internal": true
    },
    "unused_blob": {
      "foo": "bar",
      "bar": "baz"
    }
  }
}
            
RealComposer Slimmed Edge Payload55 B
              {
  "contactId": "sample",
  "email": "sample",
  "name": "sample"
}
            

Recipe Specs

HTTP method
GET
Upstream calls
1
Edge cache TTL
300s
Client auth
Restricted client token
Mapped output fields
3
Payload
247 B to 55 B (-78%)
Call from Terminal or Client
curl -X GET "https://realcomposer.com/v1/workspace/cache-salesforce-api-at-edge" \
  -H "Authorization: Bearer rc_live_client_token"
Frequently Asked Questions

Developer Questions & Troubleshooting

Can Frontend / Web call Salesforce without holding the production key?

Point Frontend / Web at /recipes/cache-salesforce-api-at-edge edge URL. RealComposer answers OPTIONS with Access-Control headers for allowed origins.

Does POST traffic get cached?

cache-salesforce-api-at-edge POST steps bypass caches.default even if cacheTtlSeconds is set in the dashboard.

How do I rotate upstream credentials?

Rotate vault secrets for cache-salesforce-api-at-edge anytime; clients keep the same rc_live_ token.

Sources & Definitions Used in This Answer

Instant Deployment

Deploy this Frontend / Web + Salesforce Recipe

Clone this pre-configured pipeline into your RealComposer workspace in one click. We pre-populate upstream URLs, headers, and mapping rules.

CLONE THIS RECIPE
Related Architecture Recipes