Skip to content
This repository was archived by the owner on Feb 16, 2023. It is now read-only.

Commit 8cc9f7e

Browse files
authored
Update readme.md
1 parent 5f5e584 commit 8cc9f7e

File tree

1 file changed

+13
-48
lines changed

1 file changed

+13
-48
lines changed

readme.md

+13-48
Original file line numberDiff line numberDiff line change
@@ -61,55 +61,20 @@ php artisan vendor:publish --tag="cors"
6161
6262
> **Note:** If you are explicitly whitelisting headers, you must include `Origin` or requests will fail to be recognized as CORS.
6363
64-
65-
```php
66-
<?php
67-
68-
return [
69-
70-
/*
71-
* You can enable CORS for 1 or multiple paths.
72-
* Example: ['api/*']
73-
*/
74-
'paths' => [],
75-
76-
/*
77-
* Matches the request method. `[*]` allows all methods.
78-
*/
79-
'allowed_methods' => ['*'],
80-
81-
/*
82-
* Matches the request origin. `[*]` allows all origins. Wildcards can be used, eg `*.mydomain.com`
83-
*/
84-
'allowed_origins' => ['*'],
85-
86-
/*
87-
* Patterns that can be used with `preg_match` to match the origin.
88-
*/
89-
'allowed_origins_patterns' => [],
90-
91-
/*
92-
* Sets the Access-Control-Allow-Headers response header. `[*]` allows all headers.
93-
*/
94-
'allowed_headers' => ['*'],
95-
96-
/*
97-
* Sets the Access-Control-Expose-Headers response header.
98-
*/
99-
'exposed_headers' => false,
100-
101-
/*
102-
* Sets the Access-Control-Max-Age response header.
103-
*/
104-
'max_age' => false,
105-
106-
/*
107-
* Sets the Access-Control-Allow-Credentials header.
108-
*/
109-
'supports_credentials' => false,
110-
];
11164

112-
```
65+
### Options
66+
67+
| Option | Description | Default value |
68+
|--------------------------|--------------------------------------------------------------------------|---------------|
69+
| paths | You can enable CORS for 1 or multiple paths, eg. `['api/*'] ` | `array()` |
70+
| allowed_origins | Matches the request origin. Wildcards can be used, eg `*.mydomain.com` | `array('*')` |
71+
| allowed_origins_patterns | Matches the request origin with `preg_match`. | `array()` |
72+
| allowed_methods | Matches the request method. | `array('*')` |
73+
| allowed_headers | Sets the Access-Control-Allow-Headers response header. | `array('*')` |
74+
| exposed_headers | Sets the Access-Control-Expose-Headers response header. | `false` |
75+
| max_age | Sets the Access-Control-Max-Age response header. | `0` |
76+
| supports_credentials | Sets the Access-Control-Allow-Credentials header. | `false` |
77+
11378

11479
`allowed_origins`, `allowed_headers` and `allowed_methods` can be set to `['*']` to accept any value.
11580

0 commit comments

Comments
 (0)