cors.js 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. 'use strict'
  2. module.exports = {
  3. /*
  4. |--------------------------------------------------------------------------
  5. | Origin
  6. |--------------------------------------------------------------------------
  7. |
  8. | Set a list of origins to be allowed. The value can be one of the following
  9. |
  10. | Boolean: true - Allow current request origin
  11. | Boolean: false - Disallow all
  12. | String - Comma seperated list of allowed origins
  13. | Array - An array of allowed origins
  14. | String: * - A wildcard to allow current request origin
  15. | Function - Receives the current origin and should return one of the above values.
  16. |
  17. */
  18. origin: false,
  19. /*
  20. |--------------------------------------------------------------------------
  21. | Methods
  22. |--------------------------------------------------------------------------
  23. |
  24. | HTTP methods to be allowed. The value can be one of the following
  25. |
  26. | String - Comma seperated list of allowed methods
  27. | Array - An array of allowed methods
  28. |
  29. */
  30. methods: ['GET', 'PUT', 'PATCH', 'POST', 'DELETE'],
  31. /*
  32. |--------------------------------------------------------------------------
  33. | Headers
  34. |--------------------------------------------------------------------------
  35. |
  36. | List of headers to be allowed via Access-Control-Request-Headers header.
  37. | The value can be on of the following.
  38. |
  39. | Boolean: true - Allow current request headers
  40. | Boolean: false - Disallow all
  41. | String - Comma seperated list of allowed headers
  42. | Array - An array of allowed headers
  43. | String: * - A wildcard to allow current request headers
  44. | Function - Receives the current header and should return one of the above values.
  45. |
  46. */
  47. headers: true,
  48. /*
  49. |--------------------------------------------------------------------------
  50. | Expose Headers
  51. |--------------------------------------------------------------------------
  52. |
  53. | A list of headers to be exposed via `Access-Control-Expose-Headers`
  54. | header. The value can be on of the following.
  55. |
  56. | Boolean: false - Disallow all
  57. | String: Comma seperated list of allowed headers
  58. | Array - An array of allowed headers
  59. |
  60. */
  61. exposeHeaders: false,
  62. /*
  63. |--------------------------------------------------------------------------
  64. | Credentials
  65. |--------------------------------------------------------------------------
  66. |
  67. | Define Access-Control-Allow-Credentials header. It should always be a
  68. | boolean.
  69. |
  70. */
  71. credentials: false,
  72. /*
  73. |--------------------------------------------------------------------------
  74. | MaxAge
  75. |--------------------------------------------------------------------------
  76. |
  77. | Define Access-Control-Allow-Max-Age
  78. |
  79. */
  80. maxAge: 90
  81. }