{"_id":"@andris/restify-cors-middleware2","_rev":"1-aca9f32c740f1bce6c8b1ceb7f7e3ee7","name":"@andris/restify-cors-middleware2","dist-tags":{"latest":"2.1.2-patch.3"},"versions":{"2.1.2-patch.2":{"name":"@andris/restify-cors-middleware2","version":"2.1.2-patch.2","author":{"name":"Datatrac Corporation"},"license":"MIT","description":"CORS middleware with full W3C spec support","keywords":["restify","cors","cross origin","headers"],"repository":{"type":"git","url":"git+https://github.com/DatatracCorporation/restify-cors-middleware.git"},"bugs":{"url":"https://github.com/DatatracCorporation/restify-cors-middleware/issues"},"main":"src/index.js","scripts":{"test":"require-lint && standard && mocha","fix":"standard --fix"},"peerDependencies":{"restify":"2.6.x - 9.x.x"},"devDependencies":{"mocha":"^8.1.3","require-lint":"^2.0.2","restify":"^8.5.1","should":"^13.2.3","standard":"^14.3.4","supertest":"^4.0.2"},"dependencies":{"assert-plus":"^1.0.0"},"types":"./src/index.d.ts","gitHead":"44f1255ae3a56dd38df040b35dfbb1fa079f0c6e","homepage":"https://github.com/DatatracCorporation/restify-cors-middleware#readme","_id":"@andris/restify-cors-middleware2@2.1.2-patch.2","_nodeVersion":"18.1.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-Bqs8BVNFKi0LezF7sxAE0VIzggeHyGrwcSqbk3W9TM8HKtXQ3I0tPfosV54EdDsX3/c/gQ/qeKUak5cHmPMIaQ==","shasum":"46272908365bb37be2b4a99d92d82b44ffbc0c89","tarball":"https://registry.npmjs.org/@andris/restify-cors-middleware2/-/restify-cors-middleware2-2.1.2-patch.2.tgz","fileCount":9,"unpackedSize":12973,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEvKz88sGjUUrlzzNszXKqCLRkziHL1tyn7GiM0m0GsAAiBEeNPqBNkbAxNmniJtHX/qtWaFiLwSlDZ/k3oY8FV+BA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjfy2KACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrqvg/+ORZDl/rf4iMuq9uf+x0dKqKatdtZ2n5QEjRX+lXKqN73+hKr\r\ndFIuEGbiL7gbd4oO18jZIWneLETi152cjwXQYSuD3nkNge9sXCCsvWwKjn0A\r\n1Fp6zUKq+iuNAipo4V6cQ84hPzZCb2zIvcyEzjVS3VlDCfNB6Ag/2QIpbn37\r\nwBGVM19IWPUhl52OjNYOkPel/h1/yHg5hdsTqLA7wuPn0GRFiEvotRfdywSt\r\nnor+G53ng4BQKicez3uUOHNonBCmGtKARnTiC2t1FQyJDeGIu3yRJusXpbIM\r\nv9CBORTYiXaVQ6voREvcKItEsc6w7b4NzKPy+RY3/d7EmsW3nuQrAf1WdyqD\r\n3sDCT78PKLBr545XWeFwKCRSSOu0k/cLo7mV9gyhruppsQ34OvULQv958d4a\r\n9wIlnE49b5AxxagRx136/v2ijKHxM+XHUnGK3cXX9lAPYn/JkUOMVqbZt/oV\r\n7LD7nzuVNwXGuxryHdfrtRO2m+mWnlZEw18UkSN4q8L0nYFXMDCY0Tcg6jys\r\njHCOCZMgBOu3zAfm7fVS/j3qBmY1dOP2yi2lzCrmKQk5EAMfDKUbVG4CfHto\r\nNiTZ9Tm340XI15/0xBOFUYs5jRmOIuS4asBBN48q5uUQcySRz1iAXS7r2k5b\r\ngIo/p8IMr9v8j2w3gfaq4azc2lApPn7rjDM=\r\n=5/6S\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"andris","email":"andris@kreata.ee"},"directories":{},"maintainers":[{"name":"andris","email":"andris@kreata.ee"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/restify-cors-middleware2_2.1.2-patch.2_1669279114462_0.30525296477640307"},"_hasShrinkwrap":false},"2.1.2-patch.3":{"name":"@andris/restify-cors-middleware2","version":"2.1.2-patch.3","author":{"name":"Datatrac Corporation"},"license":"MIT","description":"CORS middleware with full W3C spec support","keywords":["restify","cors","cross origin","headers"],"repository":{"type":"git","url":"git+https://github.com/DatatracCorporation/restify-cors-middleware.git"},"bugs":{"url":"https://github.com/DatatracCorporation/restify-cors-middleware/issues"},"main":"src/index.js","scripts":{"test":"require-lint && standard && mocha","fix":"standard --fix"},"peerDependencies":{"restify":"2.6.x - 10.x.x"},"devDependencies":{"mocha":"^8.1.3","require-lint":"^2.0.2","restify":"^8.5.1","should":"^13.2.3","standard":"^14.3.4","supertest":"^4.0.2"},"dependencies":{"assert-plus":"^1.0.0"},"types":"./src/index.d.ts","gitHead":"b3457b4341384ac83b1fc0d490d267813f54cc52","homepage":"https://github.com/DatatracCorporation/restify-cors-middleware#readme","_id":"@andris/restify-cors-middleware2@2.1.2-patch.3","_nodeVersion":"18.1.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-XTxzdPnSdp8vqQQ15Si2NLRsuv+1imh0zkkPqBnckIAho5UWy021GC5MY3LUgCrFrHqkpbl6b9Ejb1/IBqksng==","shasum":"0182ed25968323ffc0e14e598640378765562197","tarball":"https://registry.npmjs.org/@andris/restify-cors-middleware2/-/restify-cors-middleware2-2.1.2-patch.3.tgz","fileCount":9,"unpackedSize":12974,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGpc/2LtpdqpqlhLjHwj63GAR02U3yKcY27wDZkxR7ahAiEArx4+8c6wMGGzfvy6g1sLZZlt6uk4sxogqEItIsBNgHA="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjiI7JACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrOFA//fTWtjiMLPbV0uB59jHE8IWAirp1idOpFAHBh1IEh0C5SWB6C\r\nbYRQGON3W4iF2bxDos7NRwUVce/mgp0WLSQCTV0wP/FPkAphIs5zjQj5dP90\r\nXcjY07Tiw03Hxd2vC8zRuEDI0nYly8SNk1AnaXtEuMaZ3Pz81iDb4XQApAPh\r\novFhbjo2y4OLYgA7ReMzCgmzwEP6CbZJbuonY5nYMJz6vZy/ixLEN9hxzTP0\r\nchOHsiJ7F5TsZ1UCP3nmfQA+BoHuh2cbJycPoYqqoS1uhiZoKHdoEgZzp9b2\r\nGRKeLV7ULr0QJlV437OMceT7+87Xbxjfc6i5S76lasf/hRSxW/NDGGX4jcJi\r\nsfDDXfZWwcxYP4zk4lD623IMj3X5wKJ5H6HD7W1WV+NUKL7zI/YssCwHzkxU\r\n4L9TzjNrXnS2cLwcVEbqN0hfMQcTEm+VpAUbcvZzsnNW8rh4ILf1eOsC1wEY\r\nyeFzw/Z1jTFp5jof2hT5b4CtVwSv171J0DCjAVEmADH/v3UdoZNKux4HgDZD\r\nslDcODRLAbUZTSNQZJ1IiS7LefbmUHU84A88eTOYRF/Hu+QgfVbM9Dc9LzVz\r\nB1caT+7yBFAlEXXofHLreqIMiMR1XpNnwJzpH0nSWajYLzQ1o6JyMRI39VPh\r\npIGajFQV3w+vn33gXFW7Io6+nw68T9lUSWc=\r\n=k5tn\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"andris","email":"andris@kreata.ee"},"directories":{},"maintainers":[{"name":"andris","email":"andris@kreata.ee"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/restify-cors-middleware2_2.1.2-patch.3_1669893833704_0.1326675627359235"},"_hasShrinkwrap":false}},"time":{"created":"2022-11-24T08:38:34.401Z","2.1.2-patch.2":"2022-11-24T08:38:34.657Z","modified":"2022-12-01T11:23:53.966Z","2.1.2-patch.3":"2022-12-01T11:23:53.882Z"},"maintainers":[{"name":"andris","email":"andris@kreata.ee"}],"description":"CORS middleware with full W3C spec support","homepage":"https://github.com/DatatracCorporation/restify-cors-middleware#readme","keywords":["restify","cors","cross origin","headers"],"repository":{"type":"git","url":"git+https://github.com/DatatracCorporation/restify-cors-middleware.git"},"author":{"name":"Datatrac Corporation"},"bugs":{"url":"https://github.com/DatatracCorporation/restify-cors-middleware/issues"},"license":"MIT","readme":"# restify-cors-middleware2\n\n> CORS middleware with full [W3C spec](https://www.w3.org/TR/cors/) support.\n\n[![NPM](http://img.shields.io/npm/v/restify-cors-middleware2.svg?style=flat)](https://npmjs.org/package/restify-cors-middleware2)\n[![License](http://img.shields.io/npm/l/restify-cors-middleware2.svg?style=flat)](https://github.com/DatatracCorporation/restify-cors-middleware2)\n\n[![Build Status](http://img.shields.io/travis/DatatracCorporation/restify-cors-middleware2.svg?style=flat)](http://travis-ci.org/DatatracCorporation/restify-cors-middleware2)\n[![Dependencies](http://img.shields.io/david/DatatracCorporation/restify-cors-middleware2.svg?style=flat)](https://david-dm.org/DatatracCorporation/restify-cors-middleware2)\n[![Dev dependencies](http://img.shields.io/david/dev/DatatracCorporation/restify-cors-middleware2.svg?style=flat)](https://david-dm.org/DatatracCorporation/restify-cors-middleware2)\n[![Peer dependencies](http://img.shields.io/david/peer/DatatracCorporation/restify-cors-middleware2.svg?style=flat)](https://david-dm.org/DatatracCorporation/restify-cors-middleware2)\n[![Known Vulnerabilities](https://snyk.io/package/npm/restify-cors-middleware2/badge.svg)](https://snyk.io/package/npm/restify-cors-middleware2)\n\n[![JavaScript Style Guide](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)\n\n## Setup\n```sh\n$ npm install restify-cors-middleware2 --save\n```\n\n## Usage\n\n```js\nconst corsMiddleware = require('restify-cors-middleware2')\n\nconst cors = corsMiddleware({\n  preflightMaxAge: 5, //Optional\n  origins: ['http://api.myapp.com', 'http://web.myapp.com'],\n  allowHeaders: ['API-Token'],\n  exposeHeaders: ['API-Token-Expiry']\n})\n\nserver.pre(cors.preflight)\nserver.use(cors.actual)\n```\n\n## Allowed origins\n\nYou can specify the full list of domains and subdomains allowed in your application, using strings or regular expressions.\n\n```js\norigins: [\n  'http://myapp.com',\n  'http://*.myapp.com',\n  /^https?:\\/\\/myapp.com(:[\\d]+)?$/\n]\n```\n\nFor added security, this middleware sets `Access-Control-Allow-Origin` to the origin that matched, not the configured wildcard.\nThis means callers won't know about other domains that are supported.\n\nSetting `origins: ['*']` is also valid, although it comes with obvious security implications. Note that it will still return a customised response (matching Origin), so any caching layer (reverse proxy or CDN) will grow in size accordingly.\n\nBy default, credentials are not allowed for the `*` origin.  This can be\noverridden with the `allowCredentialsAllOrigins` option.\n\n## Troubleshooting\n\nAs per the spec, requests without an `Origin` will not receive any CORS headers. Requests with a matching `Origin` will receive the appropriate response headers. Always be careful that any reverse proxies (e.g. Varnish) vary their cache depending on the origin, so you don't serve CORS headers to the wrong request.\n\n## Compliance to the spec\n\nSee [unit tests](https://github.com/DatatracCorporation/restify-cors-middleware2/tree/master/test) for examples of preflight and actual requests.\n\n## TypeScript declaration file support\n\nA basic declaration file has been added (thanks to Dane Horak), but we\ndon't use TypeScript locally, so we have not validated it.  Let us know\nif there is more that can be added.\n","readmeFilename":"README.md"}