Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/oshekharo/cors-bypasser

A simple Node.js server that acts as a CORS proxy, forwarding requests to a target URL.
https://github.com/oshekharo/cors-bypasser

cors cors-anywhere cors-proxy nodejs serverless

Last synced: about 2 months ago
JSON representation

A simple Node.js server that acts as a CORS proxy, forwarding requests to a target URL.

Awesome Lists containing this project

README

        

# 🔀 CORS Proxy

## 🚀 Features

- 🔎 GET and POST requests
- 🛠 Bypasses CORS restrictions
- 📨 Includes headers in the request
- 🚦 Handles CORS preflight requests
- 🖥 Built with Express.js

## 📚 Usage

### GET Requests 📩

Simply append the target URL as a query parameter:

`https://cors-bypasser-gilt.vercel.app/fetchdata?url=YOUR_URL_HERE`

### POST Requests 📤

Send a JSON object in the body of the request with url and headers properties:

```javascript
function check(code) {
const targetUrl = `https://securepayment.zee5.com/paymentGateway/coupon/verification?coupon_code=${code}&country_code=IN&translation=en`;
const proxyUrl = 'https://cors-bypasser-gilt.vercel.app/fetchdata';
const headers = {
'Referer': 'https://b2bapi.zee5.com/',
'Origin': 'https://b2bapi.zee5.com'
}
const body = {
'coupon_code': code,
'country_code': 'IN',
'translation': 'en'
}

return fetch(proxyUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ url: targetUrl, headers: headers, body: body })
})
.then(response => {
return {status: response.status, data: response.json()};
});
}