{"id":20286892,"url":"https://github.com/chanmyaemaung/cors-proxy","last_synced_at":"2025-09-22T16:31:47.552Z","repository":{"id":122320115,"uuid":"336735269","full_name":"chanmyaemaung/cors-proxy","owner":"chanmyaemaung","description":"Cors Proxy Server","archived":false,"fork":false,"pushed_at":"2021-02-07T08:11:15.000Z","size":33,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-14T14:43:56.673Z","etag":null,"topics":["cors","javascript","nodejs","proxy"],"latest_commit_sha":null,"homepage":"https://own-cors-proxy.herokuapp.com/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chanmyaemaung.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-07T08:10:28.000Z","updated_at":"2023-09-26T11:31:20.000Z","dependencies_parsed_at":"2023-04-09T02:35:39.242Z","dependency_job_id":null,"html_url":"https://github.com/chanmyaemaung/cors-proxy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chanmyaemaung%2Fcors-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chanmyaemaung%2Fcors-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chanmyaemaung%2Fcors-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chanmyaemaung%2Fcors-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chanmyaemaung","download_url":"https://codeload.github.com/chanmyaemaung/cors-proxy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233863380,"owners_count":18742132,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cors","javascript","nodejs","proxy"],"created_at":"2024-11-14T14:37:21.131Z","updated_at":"2025-09-22T16:31:42.264Z","avatar_url":"https://github.com/chanmyaemaung.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/Rob--W/cors-anywhere.svg?branch=master)](https://travis-ci.org/Rob--W/cors-anywhere)\n[![Coverage Status](https://coveralls.io/repos/github/Rob--W/cors-anywhere/badge.svg?branch=master)](https://coveralls.io/github/Rob--W/cors-anywhere?branch=master)\n\n**CORS Anywhere** is a NodeJS proxy which adds CORS headers to the proxied request.\n\nThe url to proxy is literally taken from the path, validated and proxied. The protocol\npart of the proxied URI is optional, and defaults to \"http\". If port 443 is specified,\nthe protocol defaults to \"https\".\n\nThis package does not put any restrictions on the http methods or headers, except for\ncookies. Requesting [user credentials](http://www.w3.org/TR/cors/#user-credentials) is disallowed.\nThe app can be configured to require a header for proxying a request, for example to avoid\na direct visit from the browser.\n\n## Example\n\n```javascript\n// Listen on a specific host via the HOST environment variable\nvar host = process.env.HOST || '0.0.0.0';\n// Listen on a specific port via the PORT environment variable\nvar port = process.env.PORT || 8080;\n\nvar cors_proxy = require('cors-anywhere');\ncors_proxy.createServer({\n    originWhitelist: [], // Allow all origins\n    requireHeader: ['origin', 'x-requested-with'],\n    removeHeaders: ['cookie', 'cookie2']\n}).listen(port, host, function() {\n    console.log('Running CORS Anywhere on ' + host + ':' + port);\n});\n\n```\nRequest examples:\n\n* `http://localhost:8080/http://google.com/` - Google.com with CORS headers\n* `http://localhost:8080/google.com` - Same as previous.\n* `http://localhost:8080/google.com:443` - Proxies `https://google.com/`\n* `http://localhost:8080/` - Shows usage text, as defined in `libs/help.txt`\n* `http://localhost:8080/favicon.ico` - Replies 404 Not found\n\nLive examples:\n\n* https://cors-anywhere.herokuapp.com/\n* https://robwu.nl/cors-anywhere.html - This demo shows how to use the API.\n\n## Documentation\n\n### Client\n\nTo use the API, just prefix the URL with the API URL. Take a look at [demo.html](demo.html) for an example.\nA concise summary of the documentation is provided at [lib/help.txt](lib/help.txt).\n\nIf you want to automatically enable cross-domain requests when needed, use the following snippet:\n\n```javascript\n(function() {\n    var cors_api_host = 'cors-anywhere.herokuapp.com';\n    var cors_api_url = 'https://' + cors_api_host + '/';\n    var slice = [].slice;\n    var origin = window.location.protocol + '//' + window.location.host;\n    var open = XMLHttpRequest.prototype.open;\n    XMLHttpRequest.prototype.open = function() {\n        var args = slice.call(arguments);\n        var targetOrigin = /^https?:\\/\\/([^\\/]+)/i.exec(args[1]);\n        if (targetOrigin \u0026\u0026 targetOrigin[0].toLowerCase() !== origin \u0026\u0026\n            targetOrigin[1] !== cors_api_host) {\n            args[1] = cors_api_url + args[1];\n        }\n        return open.apply(this, args);\n    };\n})();\n```\n\nIf you're using jQuery, you can also use the following code **instead of** the previous one:\n\n```javascript\njQuery.ajaxPrefilter(function(options) {\n    if (options.crossDomain \u0026\u0026 jQuery.support.cors) {\n        options.url = 'https://cors-anywhere.herokuapp.com/' + options.url;\n    }\n});\n```\n\n### Server\n\nThe module exports `createServer(options)`, which creates a server that handles\nproxy requests. The following options are supported:\n\n* function `getProxyForUrl` - If set, specifies which intermediate proxy to use for a given URL.\n  If the return value is void, a direct request is sent. The default implementation is\n  [`proxy-from-env`](https://github.com/Rob--W/proxy-from-env), which respects the standard proxy\n  environment variables (e.g. `https_proxy`, `no_proxy`, etc.).  \n* array of strings `originBlacklist` - If set, requests whose origin is listed are blocked.  \n  Example: `['https://bad.example.com', 'http://bad.example.com']`\n* array of strings `originWhitelist` - If set, requests whose origin is not listed are blocked.  \n  If this list is empty, all origins are allowed.\n  Example: `['https://good.example.com', 'http://good.example.com']`\n* function `checkRateLimit` - If set, it is called with the origin (string) of the request. If this\n  function returns a non-empty string, the request is rejected and the string is send to the client.\n* boolean `redirectSameOrigin` - If true, requests to URLs from the same origin will not be proxied but redirected.\n  The primary purpose for this option is to save server resources by delegating the request to the client\n  (since same-origin requests should always succeed, even without proxying).\n* array of strings `requireHeader` - If set, the request must include this header or the API will refuse to proxy.  \n  Recommended if you want to prevent users from using the proxy for normal browsing.  \n  Example: `['Origin', 'X-Requested-With']`.\n* array of lowercase strings `removeHeaders` - Exclude certain headers from being included in the request.  \n  Example: `[\"cookie\"]`\n* dictionary of lowercase strings `setHeaders` - Set headers for the request (overwrites existing ones).  \n  Example: `{\"x-powered-by\": \"CORS Anywhere\"}`\n* number `corsMaxAge` - If set, an Access-Control-Max-Age request header with this value (in seconds) will be added.  \n  Example: `600` - Allow CORS preflight request to be cached by the browser for 10 minutes.\n* string `helpFile` - Set the help file (shown at the homepage).  \n  Example: `\"myCustomHelpText.txt\"`\n\nFor advanced users, the following options are also provided.\n\n* `httpProxyOptions` - Under the hood, [http-proxy](https://github.com/nodejitsu/node-http-proxy)\n  is used to proxy requests. Use this option if you really need to pass options\n  to http-proxy. The documentation for these options can be found [here](https://github.com/nodejitsu/node-http-proxy#options).\n* `httpsOptions` - If set, a `https.Server` will be created. The given options are passed to the\n  [`https.createServer`](https://nodejs.org/api/https.html#https_https_createserver_options_requestlistener) method.\n\nFor even more advanced usage (building upon CORS Anywhere),\nsee the sample code in [test/test-examples.js](test/test-examples.js).\n\n### Demo server\n\nA public demo of CORS Anywhere is available at https://cors-anywhere.herokuapp.com. This server is\nonly provided so that you can easily and quickly try out CORS Anywhere. To ensure that the service\nstays available to everyone, the number of requests per period is limited, except for requests from\nsome explicitly whitelisted origins.\n\nIf you expect lots of traffic, please host your own instance of CORS Anywhere, and make sure that\nthe CORS Anywhere server only whitelists your site to prevent others from using your instance of\nCORS Anywhere as an open proxy.\n\nFor instance, to run a CORS Anywhere server that accepts any request from some example.com sites on\nport 8080, use:\n```\nexport PORT=8080\nexport CORSANYWHERE_WHITELIST=https://example.com,http://example.com,http://example.com:8080\nnode server.js\n```\n\nThis application can immediately be run on Heroku, see https://devcenter.heroku.com/articles/nodejs\nfor instructions. Note that their [Acceptable Use Policy](https://www.heroku.com/policy/aup) forbids\nthe use of Heroku for operating an open proxy, so make sure that you either enforce a whitelist as\nshown above, or severly rate-limit the number of requests.\n\nFor example, to blacklist abuse.example.com and rate-limit everything to 50 requests per 3 minutes,\nexcept for my.example.com and my2.example.com (which may be unlimited), use:\n\n```\nexport PORT=8080\nexport CORSANYWHERE_BLACKLIST=https://abuse.example.com,http://abuse.example.com\nexport CORSANYWHERE_RATELIMIT='50 3 my.example.com my2.example.com'\nnode server.js\n```\n\n\n## License\n\nCopyright (C) 2013 - 2016 Rob Wu \u003crob@robwu.nl\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchanmyaemaung%2Fcors-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchanmyaemaung%2Fcors-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchanmyaemaung%2Fcors-proxy/lists"}