Skip to content
This repository was archived by the owner on Feb 3, 2025. It is now read-only.

mazipan/cors-hijacker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

26 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’€ 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

About

πŸ’€ A bare-minimum solution to solve CORS problem via proxy API

Topics

Resources

License

Stars

Watchers

Forks