Skip to content

bapatsharad/cors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

CORS Proxy Service

This service allows you to bypass CORS issues for your API calls.

1. Register Your Calling Domain

Register the domain where your front-end application is hosted (e.g., your-app.com).

Your Email:

Domain to Whitelist:

Register Domain & Get Dev Token

2. How to Use

A) For Deployed Applications (Live Environment)

When your app is live on your registered domain, include the X-User-Email header with your registered email in your fetch request.

const target = encodeURIComponent('https://api.example.com/data');
const workerUrl = \`https://cors.utilitykit.workers.dev//?corsUrl=\${target}\`;

fetch(workerUrl, {
method: 'GET', // Or 'POST', etc.
headers: {
  // REQUIRED: Your registered email
  'X-User-Email': 'you@example.com'
}
})
.then(res => res.json())
.then(data => console.log(data));

B) For Local Development (localhost)

When you register, you will receive a Development Token. Use this token in the X-Dev-Token header to make requests from localhost.

const target = encodeURIComponent('https://api.example.com/data');
const workerUrl = \`https://cors.utilitykit.workers.dev/?corsUrl=\${target}\`;

fetch(workerUrl, {
method: 'GET',
headers: {
  // REQUIRED: Your unique development token
  'X-Dev-Token': 'YOUR_DEV_TOKEN_HERE'
}
})
.then(res => res.json())
.then(data => console.log(data));

About

CORS Proxy Service

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors