Kibana Rest API redirects to login


I'm new to ElasticSearch and Kibana. I'm trying to use Kibana's REST API, but the response i get are redirections to /login whatever the request i try.

For example :

$ curl -v -u user:passwd -X GET ""

* Hostname was NOT found in DNS cache
*   Trying
* Connected to ( port 5601 (#0)
* Server auth using Basic with user 'user'
> GET /demo/api/features HTTP/1.1
> Authorization: Basic xxxxxxxx
> User-Agent: curl/7.38.0
> Host:
> Accept: */*
< HTTP/1.1 302 Found
< location: /demo/login?nextUrl=/demo/api/features
< kbn-name: kibana
< content-type: text/html; charset=utf-8
< cache-control: no-cache
< content-length: 0
< connection: close
< Date: Thu, 26 Nov 2020 10:32:56 GMT
* Closing connection 0

I'm using v7.2.0 with Linux.

Could someone tell me what i'm doing wrong ?

Best regards,

is kibana configured with a different basePath /demo ?

Yes. And rewriteBasePath is set to True.

The problem came from the use of the plugin readonlyrest.
I need to first log in, and retrieve the cookie, before querying for anything :

curl -v -X POST ""  -d "username=user&password=passwd"-H "kbn-xsrf: true" -H 'Accept: application/json' -c cookie.txt

And then use the cookie :

curl -v -X GET "" -H 'kbn-xsrf: true' -H 'Content-Type: application/json'  -H "Accept: application/json" -b cookie.txt

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.