# Cloudinary upload api proxy for framer website

> Framer components hit RealComposer for signed upload parameters. For "cloudinary upload api proxy for framer website", store CLOUDINARY_BASIC_AUTH in Secret Vault, call https://api.cloudinary.com/v1_1/{{secrets.CLOUDINARY_CLOUD_NAME}}/image/upload from a Worker, and let Framer hit only https://realcomposer.com/v1/workspace/cloudinary-upload-proxy-framer with an rc_live_ client token. POST upstream calls are not stored in caches.default; clients must send JSON bodies and headers forward unchanged.

- Canonical page: https://realcomposer.com/recipes/cloudinary-upload-proxy-framer
- Client platform: Framer
- Upstream services: Cloudinary
- Category: Security & Secret Vault
- JSON version: https://realcomposer.com/recipes/cloudinary-upload-proxy-framer.json
- Install in RealComposer (free plan, pre-fills this pipeline): https://realcomposer.com/dashboard/pipelines/new?recipe=cloudinary-upload-proxy-framer&via=agent

## Problem: Why Framer leaks Cloudinary credentials

Attackers routinely extract Cloudinary secrets from Framer builds. Direct browser calls also expose internal error payloads with hostnames.

- Production Cloudinary keys copied from Framer bundles
- Compliance violations after credential leaks
- Attackers replaying vault-grade scopes from a laptop

## Solution steps

1. **Add vault secrets for this pipeline**: Add CLOUDINARY_BASIC_AUTH to RealComposer Secret Vault. Values decrypt only inside the Cloudflare Worker that calls the upstream.

2. **Set headers, mapping, and cache TTL**: Use POST against https://api.cloudinary.com/v1_1/{{secrets.CLOUDINARY_CLOUD_NAME}}/image/upload. Allowed origins on the client token should match post pipelines set cache ttl to 0 because realcomposer only stores get responses at the edge. Use a restricted unsigned upload preset. The vault cannot sign upload bodies; preset rules enforce MIME and size limits.

3. **Fetch inside Framer overrides**: Call https://realcomposer.com/v1/workspace/cloudinary-upload-proxy-framer with a restricted rc_live_ client token. Framer never sends upstream secrets.

```
fetch('https://realcomposer.com/v1/workspace/cloudinary-upload-proxy-framer', {
  headers: { Authorization: 'Bearer rc_live_your_token' }
});
```

## Pipeline config

Import this config into a RealComposer pipeline. `{{secrets.NAME}}` values are read from the encrypted Secret Vault at request time, so the client never sees them.

```json
{
  "name": "Cloudinary upload api proxy for framer website",
  "method": "POST",
  "cacheTtlSeconds": 0,
  "authMode": "client_token",
  "steps": [
    {
      "stepKey": "cloudinary",
      "upstreamUrlTemplate": "https://api.cloudinary.com/v1_1/{{secrets.CLOUDINARY_CLOUD_NAME}}/image/upload",
      "httpMethod": "POST",
      "headersTemplate": {
        "Content-Type": "application/json"
      },
      "timeoutMs": 10000
    }
  ],
  "outputMapping": {
    "version": 1,
    "fields": [
      {
        "targetPath": "publicId",
        "sourcePath": "resources.0.public_id",
        "type": "string",
        "sourceStep": "cloudinary"
      },
      {
        "targetPath": "format",
        "sourcePath": "resources.0.format",
        "type": "string",
        "sourceStep": "cloudinary"
      }
    ]
  }
}
```

## Call the pipeline

```bash
curl -X POST "https://realcomposer.com/v1/workspace/cloudinary-upload-proxy-framer" \
  -H "Authorization: Bearer rc_live_client_token" \
  -H "Content-Type: application/json" \
  -d '{"model":"example"}'
```

## Payload before and after

Raw upstream response:

```json
{
  "requestId": "req_cloudina",
  "upstreamLatencyMs": 142,
  "audit": {
    "region": "edge",
    "trace": "cloudinary-upload-proxy-framer"
  },
  "payload": {
    "id": "sample_id",
    "status": "active",
    "nested": {
      "tags": [
        "demo"
      ],
      "internal": true
    },
    "unused_blob": {
      "foo": "bar",
      "bar": "baz"
    }
  }
}
```

Slimmed RealComposer response:

```json
{
  "publicId": "sample",
  "format": "sample"
}
```

## FAQ

### Can Framer call Cloudinary without holding the production key?

Point Framer at /recipes/cloudinary-upload-proxy-framer edge URL. RealComposer answers OPTIONS with Access-Control headers for allowed origins.

### Does POST traffic get cached?

cloudinary-upload-proxy-framer POST steps bypass caches.default even if cacheTtlSeconds is set in the dashboard.

### Can I restrict which domains call this pipeline?

Rotate vault secrets for cloudinary-upload-proxy-framer anytime; clients keep the same rc_live_ token.
