cors-hijacker

💀 A bare-minimum solution to solve CORS problem via proxy API

MIT License

Stars
35

CORS Hijacker

A bare-minimum solution to solve CORS problem via proxy API

Base URL

Base URL: https://cors-hijacker.vercel.app

Endpoint: ${BASE_URL}/api?url=${YOUR_ENCODED_URL}

Docs

GET

Get Basic HTML

Sample Request:

// Get html from https://mazipan.space/
const res = await fetch(
  `https://cors-hijacker.vercel.app/api?url=${encodeURIComponent(
    'https://mazipan.space/'
  )}`,
  {
    headers: {
      // Content-Type is required
      'Content-Type': 'text/html',
    },
  }
);
const html = await res.text();

Get Basic JSON

Sample Request:

const res = await fetch(
  `https://cors-hijacker.vercel.app/api?url=${encodeURIComponent(
    'https://ksana.in/api/ping'
  )}`,
  {
    headers: {
      // Content-Type is required
      'Content-Type': 'application/json',
    },
  }
);
const jsonResponse = await res.json();

POST

Sample Request:

const res = await fetch(
  `https://cors-hijacker.vercel.app/api?url=${encodeURIComponent(
    'https://ksana.in/api/ping'
  )}`,
  {
    // method is required
    method: 'POST',
    headers: {
      // Content-Type is required
      'Content-Type': 'application/json',
    },
    // body is optional
    body: JSON.stringify(additionalBodyParam),
  }
);
const jsonResponse = await res.json();

Limitations

  • Not support Form submission.
  • Removing the origin host header (see on index.ts#L48)
  • Use free-tier server from Vercel, not reliable for high traffic.

Credits


Copyright By Irfan Maulana