Skip to content
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

HTTP API & CORS Headers, backend option to enable CORS & CORS Domain #2440

Closed
HallsHalls opened this issue Aug 5, 2015 · 5 comments
Closed

Comments

@HallsHalls
Copy link

I want to use API from remote resource,

like that

$http.post('http://dwz.cn/create.php',parms, {
        headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}
      }).success(function(responseData) {
        console.log(responseData);
});

and the chrome will show:

XMLHttpRequest cannot load http://dwz.cn/create.php. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. 

and i found many solutions add Access-Control-Allow-Origin: "*" in the server conf...but i cant!

@torkelo
Copy link
Member

torkelo commented Aug 5, 2015

There is currently no option in grafana to set CORS headers (to enable api usage from other websites). You can add these headers if you proxy grafana with nginx for now.

@torkelo torkelo changed the title Use $http.post from remote url HTTP API & CORS Headers, backend option to enable CORS & CORS Domain Aug 5, 2015
@HallsHalls
Copy link
Author

thank you very much

@HallsHalls
Copy link
Author

hi, my team leader ask me why we can't use direct method to access database (we use openTSDB) and the proxy method to access be a only way , and the direct method can't use ?It is bug?or something else?

@HallsHalls
Copy link
Author

@torkelo

@torkelo
Copy link
Member

torkelo commented Aug 14, 2015

@HallsHalls you can use direct access, but then you need to enable CORS headers in your installation of OpenTSDB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants