New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api: Added ability to supports CORS for API #7357

Merged
merged 4 commits into from Sep 21, 2017

Conversation

Projects
None yet
4 participants
@laf
Member

laf commented Sep 17, 2017

DO NOT DELETE THIS TEXT

Please note

Please read this information carefully. You can run ./scripts/pre-commit.php to check your code before submitting.

Testers

If you would like to test this pull request then please run: ./scripts/github-apply <pr_id>, i.e ./scripts/github-apply 5926

Fixes: #7322

Uses https://github.com/palanik/CorsSlim.

Docs done, disabled by default.

We do need to be careful with php 5.3. A commit removes it from travis checks. Composer doesn't indicate a required version.

Edit, actually, looks ok:

sh-4.1# php -v
PHP 5.3.3 (cli) (built: Mar 22 2017 12:27:09)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
sh-4.1# ./vendor/bin/parallel-lint --exclude lib/influxdb-php/  ./vendor/palanik/
PHP 5.3.3 | 10 parallel jobs
....                                                         4/4 (100 %)


Checked 4 files in 0 seconds
No syntax error found

This change is Reviewable

@laf laf added the API label Sep 17, 2017

@mention-bot

This comment has been minimized.

Show comment
Hide comment
@mention-bot

mention-bot Sep 17, 2017

Thank you for submitting a PR @laf! We have found the following @f0o, @marcodc and @murrant based on the history of these files to review this PR.

mention-bot commented Sep 17, 2017

Thank you for submitting a PR @laf! We have found the following @f0o, @marcodc and @murrant based on the history of these files to review this PR.

@Zaxmy

This comment has been minimized.

Show comment
Hide comment
@Zaxmy

Zaxmy Sep 18, 2017

Contributor

XMLHttpRequest cannot load https://librenms.nsa.his.se/api/v0/services/xxx.xxxx.xxx.xxx. Request header field X-Auth-Token is not allowed by Access-Control-Allow-Headers in preflight response.

Include X-Auth-Token in the default example, might be good idee ?

Contributor

Zaxmy commented Sep 18, 2017

XMLHttpRequest cannot load https://librenms.nsa.his.se/api/v0/services/xxx.xxxx.xxx.xxx. Request header field X-Auth-Token is not allowed by Access-Control-Allow-Headers in preflight response.

Include X-Auth-Token in the default example, might be good idee ?

@laf

This comment has been minimized.

Show comment
Hide comment
@laf

laf Sep 18, 2017

Member

X-Auth-Token added

Member

laf commented Sep 18, 2017

X-Auth-Token added

@Zaxmy

This comment has been minimized.

Show comment
Hide comment
@Zaxmy

Zaxmy Sep 19, 2017

Contributor

Reviewed 27 of 28 files at r1, 1 of 1 files at r2.
Review status: all files reviewed at latest revision, 1 unresolved discussion.


doc/Support/Configuration.md, line 621 at r2 (raw file):

$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 ought to be added here


Comments from Reviewable

Contributor

Zaxmy commented Sep 19, 2017

Reviewed 27 of 28 files at r1, 1 of 1 files at r2.
Review status: all files reviewed at latest revision, 1 unresolved discussion.


doc/Support/Configuration.md, line 621 at r2 (raw file):

$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 ought to be added here


Comments from Reviewable

@Zaxmy

This comment has been minimized.

Show comment
Hide comment
@Zaxmy

Zaxmy Sep 19, 2017

Contributor

X-Auth-Token missing in documentation for doc/Support/Configuration.md

Contributor

Zaxmy commented Sep 19, 2017

X-Auth-Token missing in documentation for doc/Support/Configuration.md

@scrutinizer-notifier

This comment has been minimized.

Show comment
Hide comment
@scrutinizer-notifier

scrutinizer-notifier Sep 19, 2017

The inspection completed: No new issues

scrutinizer-notifier commented Sep 19, 2017

The inspection completed: No new issues

@laf

This comment has been minimized.

Show comment
Hide comment
@laf

laf Sep 20, 2017

Member

This should be all up to date now.

Member

laf commented Sep 20, 2017

This should be all up to date now.

@laf laf merged commit 1be5508 into librenms:master Sep 21, 2017

2 of 3 checks passed

code-review/reviewable 1 file, 1 discussion left (laf, Zaxmy)
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
license/cla Contributor License Agreement is signed.
Details

@laf laf deleted the laf:api/issue-7322 branch Sep 21, 2017

@lock

This comment has been minimized.

Show comment
Hide comment
@lock

lock bot May 17, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed.

lock bot commented May 17, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed.

@lock lock bot locked as resolved and limited conversation to collaborators May 17, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.