Kibana: Intermittent 406 with short URLs

Created on 19 Feb 2017  路  5Comments  路  Source: elastic/kibana

Kibana version: 5.2.0
Elasticsearch version: 5.2.0
Server OS version: Ubuntu 16.04.2
Browser version: Firefox 50.1.0
Browser OS version: Ubuntu 14.04.5
Original install method (e.g. download page, yum, from source, etc.): Apt
Description of the problem including expected versus actual behavior: Visiting a short URL sometimes produces a 406 error, rather than the expected dashboard.

Steps to reproduce:

  1. Share and create shortened URL for Kibana dashboard
  2. Visit shortened URL
  3. Occasionally a shortened URL is created which produces this error:
    {"statusCode":406,"error":"Not Acceptable","message":"Short url target path must be in the format \"/app/{{appId}}\", found \"/\""}

I have only seen this error twice and am unable to reproduce it for this issue. However I did notice that although the error persists over time (days), as soon as a second short URL is created for the same dashboard, the error no longer occurs.

First occurred immediately after upgrading from 5.1.0 to 5.2.0 .

bug

Most helpful comment

This error occurs when Kibana gets an error while querying it's ES index for the short-url document. The true error is swallowed and a default value of "/" is returned when trying to get the target path for the short URL. In our case this was due to our ES using authentication which the server-side code failed to supply.

The problem is that short_url_lookup.js->getUrlDoc uses callWithRequest to access ES. callWithRequest tries to use the credentials passed to the request kibana got, but requests to /goto/{id} path do not require auth, and hence will be missing it in some cases.

Hacky workaround: I just changed getUrlDoc code to use callWithInternalUser instead. This bypasses the need for authentication. Works perfectly for us. Not sure, but maybe forcing auth on the goto path might be a more reasonable approach.

All 5 comments

I'm seeing this as well after upgrading from 4.4.2 to 4.6.4.

It seems target URL validation landed in the following commit:
https://github.com/elastic/kibana/commit/bc118d947428316f61381a262a844b7937941d50

However, this breaks older existing short URLs which seemed to have absolute URLs in the target URL.

This can be seen when looking at _type:url objects in the .kibana index.

This is also the error returned when a short url is not found, instead of a 404.

Is there any update on this? Currently running 5.3.0 and it's become impossible to share links with people.

@ceeeekay Sounds like you are running into this issue: https://github.com/elastic/kibana/issues/10951. There was an issue in 5.3.0 which broke the share urls, it will be fixed in 5.3.1.

This error occurs when Kibana gets an error while querying it's ES index for the short-url document. The true error is swallowed and a default value of "/" is returned when trying to get the target path for the short URL. In our case this was due to our ES using authentication which the server-side code failed to supply.

The problem is that short_url_lookup.js->getUrlDoc uses callWithRequest to access ES. callWithRequest tries to use the credentials passed to the request kibana got, but requests to /goto/{id} path do not require auth, and hence will be missing it in some cases.

Hacky workaround: I just changed getUrlDoc code to use callWithInternalUser instead. This bypasses the need for authentication. Works perfectly for us. Not sure, but maybe forcing auth on the goto path might be a more reasonable approach.

Was this page helpful?
0 / 5 - 0 ratings