api: Added ability to supports CORS for API (#7357)

* Update defaults.inc.php

* api: Added ability to supports CORS for API

* added acknowledge

* Update Configuration.md
This commit is contained in:
Neil Lathwood
2017-09-21 18:07:31 +01:00
committed by GitHub
parent 6ea6218f47
commit 1be550826e
28 changed files with 1421 additions and 184 deletions

View File

@@ -603,3 +603,20 @@ $config['ipmi']['type'][] = "open";
### Distributed poller settings
[Distributed Poller](../Extensions/Distributed-Poller.md)
## API Settings
### CORS Support
https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS
CORS support for the API is disabled by default. Below you will find the standard options,
all of which you can configure.
```php
$config['api']['cors']['enabled'] = false;
$config['api']['cors']['origin'] = '*';
$config['api']['cors']['maxage'] = '86400';
$config['api']['cors']['allowmethods'] = array('POST', 'GET', 'PUT', 'DELETE', 'PATCH');
$config['api']['cors']['allowheaders'] = array('Origin', 'X-Requested-With', 'Content-Type', 'Accept', 'X-Auth-Token');
```