I have Grafana installed in a Docker container ( grafana/grafana
image from Docker repo) with port 3000 redirected to my localhost. My docker-compose.yml
below:
version: '2.1'
services:
grafana:
image: grafana/grafana
ports:
- 3000:3000
Initially, I also have a link to Graphite and some volumes and environment configuration (only GF_SECURITY_ADMIN_PASSWORD
), but I suppose that doesn't matter.
I can get a response from Grafana via a simple call curl
:
$ curl http://localhost:3000
<a href="/login">Found</a>.
But when I try to get it through an AJAX call, it gives me a strange result:
$.ajax({url: 'http://localhost:3000', beforeSend: function(xhr, settings) {alert('before setting header'); xhr.setRequestHeader('Access-Control-Allow-Origin', '*'); alert('after setting header');}});
[many JSON fields]
responseText:""
[many JSON fields]
statusText: "error"
[many JSON fields]
Alerts say the header is configured to accept requests from any source.
The same thing happens (curl works, but ajax doesn't) when I call the address of the Docker container directly.
? ? Grafana AJAX?