Skip to content

CORS Proxy

Fetch external APIs from artifact JavaScript without CORS errors. ShareOut proxies the request server-side and forwards the response.

const sdk = await ShareOut.create();
// Per-artifact proxy (recommended)
const proxyUrl = `https://shareout.site/v1/data/${sdk.artifactId}/proxy`;
const response = await fetch(`${proxyUrl}?url=${encodeURIComponent('https://api.weather.gov/points/39.7456,-104.9910')}`);
const data = await response.json();
ScenarioSolution
API without CORS headersUse the proxy
Public APIs (weather, crypto, etc.)Use the proxy
API that already sends CORS headersDirect fetch
Your own APIAdd CORS headers on your server

Per-artifact proxy (isolated rate limits, configurable):

GET https://shareout.site/v1/data/{artifactId}/proxy?url=<encoded-url>

Global proxy (shared IP-based rate limit, no config):

GET https://shareout.site/api/proxy?url=<encoded-url>
// Global proxy — simpler, no artifact context needed
const response = await fetch(
`https://shareout.site/api/proxy?url=${encodeURIComponent('https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd')}`
);
ConstraintValue
MethodGET only
Rate limit100 req/min per artifact
Response size10 MB max
Timeout10 seconds
Cache TTL5 min default
// Read current config
const config = await fetch(`/v1/data/${artifactId}/proxy/config`, {
headers: { 'Authorization': `Bearer ${token}` },
}).then(r => r.json());
// Update config
await fetch(`/v1/data/${artifactId}/proxy/config`, {
method: 'PUT',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
enabled: true,
allowed_hosts: ['api.weather.gov', 'api.coingecko.com'],
blocked_hosts: ['internal.company.com'],
cache_ttl: 600,
max_requests_per_minute: 50,
}),
});
FieldTypeDefaultDescription
enabledbooleantrueEnable or disable the proxy for this artifact
allowed_hostsstring[]nullAllowlist — null means any host
blocked_hostsstring[]nullBlocklist
cache_ttlnumber300Cache TTL in seconds (0–3600)
max_requests_per_minutenumber100Rate limit (1–1000)
HeaderDescription
X-Proxy-CacheHIT or MISS
X-RateLimit-RemainingRequests remaining in the current window

Blocked automatically:

  • Internal IPs: 127.0.0.1, localhost, 10.x, 192.168.x, 169.254.x
  • Schemes: file://, javascript:, data:
  • Set-Cookie headers are stripped from responses
CodeMeaning
BLOCKED_DESTINATIONInternal IP or disallowed scheme
HOST_NOT_ALLOWEDHost not in allowed_hosts
PROXY_RATE_LIMITEDRate limit exceeded
FILE_TOO_LARGEResponse exceeds 10 MB
PROXY_ERRORUpstream request failed