Skip to content

ManimuthurajT/cors-proxy

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cors-proxy

nest badge

$ deno run --allow-net https://deno.land/x/cors_proxy/mod.ts

Instead of fetching https://duck.com you can now fetch http://localhost:3000/cors/https://duck.com.

Configuration

You can configure the port, route, allowed URLs and allowed origins of the server via these arguments:

$ deno run https://deno.land/x/cors_proxy/mod.ts --help
This CORS proxy fetches remote URLs and adds CORS headers so that blocked Cross-Origin requests belong to the past.

You can adjust the following settings when using this module:
  -p, --port, env: PORT
    Port - set the port for your server (number)
    Default: 3000

  -r, --route, env: CORS_ROUTE_PREFIX
    Route to serve requests, i.e. <your-server-url>:<port><route><requested-url>
    e.g. https://cors-proxy.example.com/cors/https://duck.com
    Default: "/cors/"

  -u, --allowed-urls, env: ALLOWED_URLS
    URLs to serve - set URLs you want to be able to forward (comma separated list, e.g. "https://domain1.com,https://domain2.org")
    Default: "" ("" = all URLs are allowed)

  -o, --allowed-origins, env: ALLOWED_ORIGINS
    Value for Access-Control-Allow-Origin header
    Default: "*" ("*" = all origins are allowed)

Example usage

$ deno run --allow-net https://deno.land/x/cors_proxy/mod.ts \
    --port 1337 \
    --route / \
    --allowed-urls https://duck.com,https://firefox.com \
    --allowed-origins https://my-webapp.example.com

About

This CORS proxy fetches remote URLs and adds CORS headers so that blocked Cross-Origin requests belong to the past.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%