Skip to content

Commit

Permalink
# Update...
Browse files Browse the repository at this point in the history
  • Loading branch information
aymardkouakou committed Apr 28, 2019
1 parent 75943e2 commit df4a1d7
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 3 deletions.
44 changes: 42 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,46 @@ $middlewareQueue

By default the middleware authorize cors for all origins, all methods and all headers. No configuration required for work fine.

## TODO
## Custom configuration

Documentation for custom configuration
For using custom configuration, you must adding a ````Cors```` array in your ````config/app.php```` file.

````php
'Cors' => [

// Authorized options here

'AllowOrigin' => string|array,
'AllowMethods' => array,
'AllowHeaders' => array,
'ExposeHeaders' => array,
'AllowCredentials' => true|false,
'Maxge' => int

]
````

## Authorized options

#### Allow all domains

````php
'AllowOrigin' => '*'
// Or
'AllowOrigin' => ['*']
````

#### Allow one domain only

````php
'AllowOrigin' => 'localhost:4200'
````

#### Allow multiple domains

````php
'AllowOrigin' => [
'localhost:4200',
...
]
````
2 changes: 1 addition & 1 deletion src/CorsMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CorsMiddleware
public const CORS_ALLOW_HEADERS_TAG = "AllowHeaders";
public const CORS_ALLOW_CREDENTIALS_TAG = "AllowCredentials";
public const CORS_EXPOSE_HEADERS_TAG = "ExposeHeaders";
public const CORS_MAX_AGE_TAG = "ExposeHeaders";
public const CORS_MAX_AGE_TAG = "MaxAge";

/**
* @param CorsBuilder $corsBuilder
Expand Down

0 comments on commit df4a1d7

Please sign in to comment.