Documentation
CORSPORXY Logo

Documentation → general

How to Use CorsProxy

This page covers the recommended URL format, proper URL encoding, and copy-paste examples.

Use the ?url= query parameter:

https://corsproxy.io/?url=<ENCODED_TARGET_URL>

In other words, corsproxy.io/?url= is the prefix and your encoded target URL goes into the url parameter.

Example:

https://corsproxy.io/?url=https%3A%2F%2Fapi.github.com%2Fusers%2Foctocat

Always encodeURIComponent() the target URL

If your target URL contains ?, &, spaces, or non-ASCII characters, encode it first:

const targetUrl = 'https://api.example.com/search?q=hello world&type=json';
const proxyUrl = `https://corsproxy.io/?url=${encodeURIComponent(targetUrl)}`;

const res = await fetch(proxyUrl);

JavaScript (fetch)

const url = 'https://corsproxy.io/?url=' + encodeURIComponent('https://httpbin.org/get');
const res = await fetch(url);

if (!res.ok) throw new Error(`HTTP ${res.status}`);
const data = await res.json();
console.log(data);

cURL

curl "https://corsproxy.io/?url=https%3A%2F%2Fhttpbin.org%2Fget"

Common mistakes

  • Not encoding the target URL (results in broken query strings).
  • Using the less-compatible direct query format (?https://...) for complex URLs.
  • Treating upstream 403 responses as “CORS errors” (see 403 Forbidden).