{
  "slug": "edge-caching-reverse-proxy",
  "title": "Edge Caching Reverse Proxy for REST Apis",
  "metaDescription": "Edge caching reverse proxy for rest apis. Shield REST API with 300s GET edge cache; cache key uses query params on edge-caching-reverse-proxy.",
  "headline": "REST API GET traffic cached ahead of rate limits",
  "category": "caching",
  "categoryLabel": "Edge Caching & Rate Limits",
  "urgency": 8,
  "clientPlatform": "Frontend / Web",
  "upstreamServices": [
    "REST API"
  ],
  "searchIntentQuery": "edge caching reverse proxy for rest apis",
  "directAnswerSummary": "REST API rate limits hit fast from Frontend / Web. Cache 300s on GET calls where the query string scopes the response.",
  "problem": {
    "title": "REST API rate limits from Frontend / Web traffic",
    "explanation": "Without edge caching, identical REST API reads during a session still round-trip to the origin.",
    "risks": [
      "HTTP 429 responses during launch traffic",
      "Surprise SaaS overages from duplicate reads",
      "Slower repeat views than necessary"
    ]
  },
  "solutionSteps": [
    {
      "stepNumber": 1,
      "title": "Bind vault keys to the Worker",
      "description": "Add API_BEARER_TOKEN to RealComposer Secret Vault. Values decrypt only inside the Cloudflare Worker that calls the upstream."
    },
    {
      "stepNumber": 2,
      "title": "Configure upstream steps and output mapping",
      "description": "Use GET against https://jsonplaceholder.typicode.com/users/{{query.userId}}. Allowed origins on the client token should match set cache ttl to 300s so repeat gets with the same query string hit caches.default."
    },
    {
      "stepNumber": 3,
      "title": "Call from Frontend / Web",
      "description": "Authorize with Bearer rc_live_ and fetch the mapped JSON contract your UI already expects.",
      "codeSnippet": "const res = await fetch('https://realcomposer.com/v1/workspace/edge-caching-reverse-proxy', {\n  headers: { Authorization: 'Bearer rc_live_your_token' }\n});"
    }
  ],
  "pipelineConfig": {
    "name": "Edge Caching Reverse Proxy for REST Apis",
    "method": "GET",
    "cacheTtlSeconds": 300,
    "authMode": "client_token",
    "steps": [
      {
        "stepKey": "upstream",
        "upstreamUrlTemplate": "https://jsonplaceholder.typicode.com/users/{{query.userId}}",
        "httpMethod": "GET",
        "headersTemplate": {
          "Authorization": "Bearer {{secrets.API_BEARER_TOKEN}}"
        },
        "timeoutMs": 3000
      }
    ],
    "outputMapping": {
      "version": 1,
      "fields": [
        {
          "targetPath": "userId",
          "sourcePath": "id",
          "type": "number",
          "sourceStep": "upstream"
        },
        {
          "targetPath": "name",
          "sourcePath": "name",
          "type": "string",
          "sourceStep": "upstream"
        },
        {
          "targetPath": "email",
          "sourcePath": "email",
          "type": "string",
          "sourceStep": "upstream"
        }
      ]
    }
  },
  "sampleBloatedInput": {
    "requestId": "req_edge-cac",
    "upstreamLatencyMs": 142,
    "audit": {
      "region": "edge",
      "trace": "edge-caching-reverse-proxy"
    },
    "payload": {
      "id": "sample_id",
      "status": "active",
      "nested": {
        "tags": [
          "demo"
        ],
        "internal": true
      },
      "unused_blob": {
        "foo": "bar",
        "bar": "baz"
      }
    }
  },
  "sampleSlimmedOutput": {
    "userId": "sample",
    "name": "sample",
    "email": "sample"
  },
  "curlSnippet": "curl -X GET \"https://realcomposer.com/v1/workspace/edge-caching-reverse-proxy\" \\\n  -H \"Authorization: Bearer rc_live_client_token\"",
  "faqs": [
    {
      "question": "Is it safe to log REST API responses in Frontend / Web?",
      "answer": "Yes for edge-caching-reverse-proxy. Ship only an rc_live_ client token in Frontend / Web; RealComposer injects API_BEARER_TOKEN on https://jsonplaceholder.typicode.com/users/{{query.userId}}."
    },
    {
      "question": "Will Anthropic or Linear prompt bodies be rewritten?",
      "answer": "edge-caching-reverse-proxy vault headers attach server-side, but Anthropic or OpenAI model and messages must come from the client body."
    },
    {
      "question": "Can I restrict which domains call this pipeline?",
      "answer": "Allowed origins on the edge-caching-reverse-proxy client token restrict which domains may call the edge URL."
    }
  ],
  "relatedRecipeSlugs": [
    "merge-linear-and-github-pr-api",
    "simplify-supabase-rest-queries",
    "connect-stripe-to-retool-securely"
  ],
  "updatedAt": "2026-11-20",
  "links": {
    "page": "https://realcomposer.com/recipes/edge-caching-reverse-proxy",
    "markdown": "https://realcomposer.com/recipes/edge-caching-reverse-proxy.md",
    "json": "https://realcomposer.com/recipes/edge-caching-reverse-proxy.json",
    "install": "https://realcomposer.com/dashboard/pipelines/new?recipe=edge-caching-reverse-proxy&via=agent"
  }
}