|
| 1 | +<?php |
| 2 | + |
| 3 | +return [ |
| 4 | + /* |
| 5 | + |-------------------------------------------------------------------------- |
| 6 | + | Configure allowed origins |
| 7 | + |-------------------------------------------------------------------------- |
| 8 | + | |
| 9 | + | Configures the Access-Control-Allow-Origin CORS header. Possible values: |
| 10 | + | |
| 11 | + | * String - set origin to a specific origin. For example if |
| 12 | + | you set it to "http://example.com" only requests from |
| 13 | + | "http://example.com" will be allowed. |
| 14 | + | |
| 15 | + | * RegExp - set origin to a regular expression pattern which will be |
| 16 | + | used to test the request origin. If it's a match, the request origin |
| 17 | + | will be reflected. For example the pattern /example\.com$/ will reflect |
| 18 | + | any request that is coming from an origin ending with "example.com". |
| 19 | + | |
| 20 | + | * Array - set origin to an array of valid origins. Each origin can be a String |
| 21 | + | or a RegExp. For example ["http://example1.com", /\.example2\.com$/] will |
| 22 | + | accept any request from "http://example1.com" or from |
| 23 | + | a subdomain of "example2.com". |
| 24 | + | |
| 25 | + | * Function - set origin to a function implementing some custom |
| 26 | + | logic. The function takes the request origin as the first parameter |
| 27 | + | and a callback (called as callback(err, origin), where origin is a |
| 28 | + | non-function value of the origin option) as the second. |
| 29 | + | |
| 30 | + */ |
| 31 | + "origin" => "*", |
| 32 | + |
| 33 | + /* |
| 34 | + |-------------------------------------------------------------------------- |
| 35 | + | Configure allowed HTTP methods |
| 36 | + |-------------------------------------------------------------------------- |
| 37 | + | |
| 38 | + | Configures the Access-Control-Allow-Methods CORS header. |
| 39 | + | Expects a comma-delimited string (ex: 'GET,PUT,POST') or |
| 40 | + | an array (ex: ['GET', 'PUT', 'POST']) |
| 41 | + | |
| 42 | + */ |
| 43 | + "methods" => "GET,HEAD,PUT,PATCH,POST,DELETE", |
| 44 | + |
| 45 | + /* |
| 46 | + |-------------------------------------------------------------------------- |
| 47 | + | Configure allowed HTTP headers |
| 48 | + |-------------------------------------------------------------------------- |
| 49 | + | |
| 50 | + | Configures the Access-Control-Allow-Headers CORS header. Expects a |
| 51 | + | comma-delimited string (ex: 'Content-Type,Authorization') or |
| 52 | + | an array (ex: ['Content-Type', 'Authorization']). If not specified, |
| 53 | + | defaults to reflecting the headers specified in the request's |
| 54 | + | Access-Control-Request-Headers header. |
| 55 | + | |
| 56 | + */ |
| 57 | + "allowedHeaders" => "*", |
| 58 | + |
| 59 | + /* |
| 60 | + |-------------------------------------------------------------------------- |
| 61 | + | Configure expose headers |
| 62 | + |-------------------------------------------------------------------------- |
| 63 | + | |
| 64 | + | Configures the Access-Control-Expose-Headers CORS header. Expects |
| 65 | + | a comma-delimited string (ex: 'Content-Range,X-Content-Range') |
| 66 | + | or an array (ex: ['Content-Range', 'X-Content-Range']). |
| 67 | + | If not specified, no custom headers are exposed. |
| 68 | + | |
| 69 | + */ |
| 70 | + "exposedHeaders" => "", |
| 71 | + |
| 72 | + /* |
| 73 | + |-------------------------------------------------------------------------- |
| 74 | + | Configure credentials |
| 75 | + |-------------------------------------------------------------------------- |
| 76 | + | |
| 77 | + | Configures the Access-Control-Allow-Credentials CORS header. |
| 78 | + | Set to true to pass the header, otherwise it is omitted. |
| 79 | + | |
| 80 | + */ |
| 81 | + "credentials" => false, |
| 82 | + |
| 83 | + /* |
| 84 | + |-------------------------------------------------------------------------- |
| 85 | + | Configure max age |
| 86 | + |-------------------------------------------------------------------------- |
| 87 | + | |
| 88 | + | Configures the Access-Control-Max-Age CORS header. Set to |
| 89 | + | an integer to pass the header, otherwise it is omitted. |
| 90 | + | |
| 91 | + */ |
| 92 | + "maxAge" => null, |
| 93 | + |
| 94 | + /* |
| 95 | + |-------------------------------------------------------------------------- |
| 96 | + | Configure preflight continue |
| 97 | + |-------------------------------------------------------------------------- |
| 98 | + | |
| 99 | + | Pass the CORS preflight response to the next handler. |
| 100 | + | |
| 101 | + */ |
| 102 | + "preflightContinue" => false, |
| 103 | + |
| 104 | + /* |
| 105 | + |-------------------------------------------------------------------------- |
| 106 | + | Log open |
| 107 | + |-------------------------------------------------------------------------- |
| 108 | + | |
| 109 | + | Provides a status code to use for successful OPTIONS requests, |
| 110 | + | since some legacy browsers (IE11, various SmartTVs) choke on 204. |
| 111 | + | |
| 112 | + */ |
| 113 | + "optionsSuccessStatus" => 204, |
| 114 | +]; |
0 commit comments