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

[es] Fix ipv6 addresses used with angular connector #29891

Merged
merged 2 commits into from
Feb 26, 2019

Conversation

jbudz
Copy link
Member

@jbudz jbudz commented Feb 1, 2019

When passing a host url to elasticsearch-js, it will use url.parse to pick fields ref.

url.parse().hostname does not include brackets in ipv6 addresses:

> url.parse('http://[::1]')
Url {
  protocol: 'http:',
  slashes: true,
  auth: null,
  host: '[::1]',
  port: null,
  hostname: '::1',
  hash: null,
  search: null,
  query: null,
  pathname: '/',
  path: '/',
  href: 'http://[::1]/' }

window does include brackets in ipv6 addresses:

window.location.hostname
"[::1]"

For browser requests we want these wrapped. Instead of url.parsing, this passes in a host object. An upstream fix is probably ideal but not as straight forward, I believe hosts are environment agnostic. @delvedor any thoughts? I could look into a client fix, or wait until elasticsearch-js@next?

To reproduce:

elasticsearch.hosts: http://[::1]:9200
server.host: "::0"

and visit any page using the angular connector, e.g. discover.

Closes #23764
Closes #9157

@jbudz jbudz added review Team:Operations Team label for Operations Team labels Feb 1, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-operations

@elasticmachine
Copy link
Contributor

💔 Build Failed

@delvedor
Copy link
Member

delvedor commented Feb 2, 2019

Hello! The next client will no longer use url.parse since it is deprecated, but it uses the new WHATWG URL API, which should fix this issue :)

> new URL('http://[::1]')
URL {
  href: 'http://[::1]/',
  origin: 'http://[::1]',
  protocol: 'http:',
  username: '',
  password: '',
  host: '[::1]',
  hostname: '[::1]',
  port: '',
  pathname: '/',
  search: '',
  searchParams: URLSearchParams {},
  hash: '' }

@jbudz
Copy link
Member Author

jbudz commented Feb 4, 2019

retest

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@jbudz jbudz requested a review from a team February 4, 2019 19:56
@joshdover
Copy link
Contributor

So I'm ignorant about how most of our legacy code works, but why does any frontend code access Elasticsearch directly? Or in other words, how is it that anything parsed by Angular code ends up in our elasticsearch-js client?

@jbudz
Copy link
Member Author

jbudz commented Feb 7, 2019

nice, story time:

Kibana 4.0.0 was initially a client side application that you provided your own server for. A server was thrown in before release, and instead of rewriting every endpoint, a proxy to elasticsearch through the Kibana server was made. We've migrated away from this over time but it still exists in courier.

elasticsearch-js has separate browser and server installs but they share some code.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Member

@mistic mistic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jbudz jbudz removed the v6.7.0 label Feb 26, 2019
@jbudz jbudz merged commit e1339aa into elastic:master Feb 26, 2019
@w33ble
Copy link
Contributor

w33ble commented Mar 11, 2019

I have not confirmed this, but I suspect they may have also closed #23431

Reading that issue again, I think that's unlikely actually...

@ypid-geberit
Copy link

ypid-geberit commented Mar 15, 2019

From the timeline it looks as this patch has made it into kibana-7.0.0-beta1-x86_64.rpm but I have experienced the issue on beta1 just now. Can you test this?

@jbudz
Copy link
Member Author

jbudz commented Mar 15, 2019

Didn't make it, it was close - the cutoff was on Feb 13. It'll be in rc1.

@w33ble
Copy link
Contributor

w33ble commented Mar 19, 2019

@jbudz was there a reason this didn't make it into the 6.x branch at all? It's been an issue for a while, and this discuss issue seems to indicate that the fix works in 6.3.2.

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

Successfully merging this pull request may close these issues.

Kibana IPV6 "No living Connections" Error when accessing Kibana using IPv6
7 participants