Files
zoff/server/node_modules/cors-anywhere/package.json
Kasper Rynning-Tønnesen 6f20b1285e Trying to fix pinned posts
2015-11-13 23:40:14 +01:00

51 lines
6.6 KiB
JSON
Executable File

{
"name": "cors-anywhere",
"version": "0.2.3",
"description": "CORS Anywhere is a reverse proxy which adds CORS headers to the proxied request. Request URL is taken from the path",
"license": "MIT",
"author": {
"name": "Rob Wu",
"email": "rob@robwu.nl"
},
"repository": {
"type": "git",
"url": "https://github.com/Rob--W/cors-anywhere.git"
},
"bugs": {
"url": "https://github.com/Rob--W/cors-anywhere/issues/",
"email": "rob@robwu.nl"
},
"keywords": [
"cors",
"cross-domain",
"http-proxy",
"proxy",
"heroku"
],
"main": "./lib/cors-anywhere.js",
"dependencies": {
"http-proxy": "1.11.1"
},
"devDependencies": {
"mocha": "~2.2.4",
"nock": "~1.9.0",
"supertest": "~0.15.0"
},
"scripts": {
"test": "./node_modules/.bin/mocha ./test/test*.js --reporter spec",
"start": "node server.js"
},
"engines": {
"node": ">=0.6.6",
"npm": ">=1.1.0"
},
"readme": "**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\nThe package also includes a Procfile, to run the app on Heroku. More information about\nHeroku can be found at https://devcenter.heroku.com/articles/nodejs.\n\n## Example\n\n```javascript\n// Heroku defines the environment variable PORT, and requires the binding address to be 0.0.0.0\nvar host = process.env.PORT ? '0.0.0.0' : '127.0.0.1';\nvar port = process.env.PORT || 8080;\n\nvar cors_proxy = require('cors-anywhere');\ncors_proxy.createServer({\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 && targetOrigin[0].toLowerCase() !== origin &&\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 && jQuery.support.cors) {\n options.url = 'https://cors-anywhere.herokuapp.com/' + options.url;\n }\n});\n```\n\n### Server\n\nThe module exports two properties: `getHandler` and `createServer`.\n\n* `getHandler(options)` returns a handler which implements the routing logic.\n This handler is used by [http-proxy](https://github.com/nodejitsu/node-http-proxy).\n* `createServer(options)` creates a server with the default handler.\n\nThe following options are recognized by both methods:\n\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\n`createServer` recognizes the following option as well:\n\n* `httpProxyOptions` - Options for 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\n\n## Dependencies\n\n- NodeJitsu's [http-proxy](https://github.com/nodejitsu/node-http-proxy)\n\n\n## License\n\nCopyright (C) 2013 - 2015 Rob Wu <rob@robwu.nl>\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",
"readmeFilename": "README.md",
"_id": "cors-anywhere@0.2.3",
"dist": {
"shasum": "4113abc518bcfff81c8f6e009ca330f760176fbd"
},
"_from": "cors-anywhere@",
"_resolved": "https://registry.npmjs.org/cors-anywhere/-/cors-anywhere-0.2.3.tgz"
}