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

Specifying a schema (http/https) as part of a host definition will override the default port #110

Open
n0othing opened this issue Feb 25, 2019 · 1 comment · May be fixed by #112
Open
Assignees
Labels

Comments

@n0othing
Copy link

Tested on: logstash-filter-elasticsearch (3.6.0)

Defining a connection schema will override the default port (9200) for a given host.

Scenario: Elasticsearch node bound to loopback/localhost:

  • hosts => ["localhost:9200"] - works
  • hosts => ["localhost"] - works
  • hosts => ["http://localhost"] - doesn't work
@yaauie
Copy link
Contributor

yaauie commented Mar 22, 2019

I've filed a bug on the Elasticsearch Ruby Client (elastic/elasticsearch-ruby#625), since their use of URI#parse is what is introducing the faulty defaults.

Since this project is pinned to 5.x I'm going to look into

  • (a) what would it cost to fix upstream and upgrade us to absorb the fix VS
  • (b) is this something that I can fix locally in a way that doesn't introduce more edge-cases

yaauie added a commit to yaauie/logstash-filter-elasticsearch that referenced this issue Mar 26, 2019
An upstream bug in the Elasticsearch Ruby Client's handling of `String` host
arguments that begin with a schema (e.g., `https://localhost`) causes it to
default to port 80 or 443, depending on the schema, instead of Elasticsearch's
port 9200.

Since the Elasticsearch Ruby Client will accept a `URI` in this case, and will
correctly handle falling through to appropriate defaults, we normalise to
`URI::Generic`, which does not have a default port.

We absorb the `ssl => true` case into this normalisation, as its previous
implementation prevented the use of non-default ports in the array provided
to `hosts`.

Supersedes: logstash-plugins#104
Resolves:   logstash-plugins#110
yaauie added a commit to yaauie/logstash-filter-elasticsearch that referenced this issue Mar 26, 2019
An upstream bug in the Elasticsearch Ruby Client's handling of `String` host
arguments that begin with a schema (e.g., `https://localhost`) causes it to
default to port 80 or 443, depending on the schema, instead of Elasticsearch's
port 9200.

Since the Elasticsearch Ruby Client will accept a `URI` in this case, and will
correctly handle falling through to appropriate defaults, we normalise to
`URI::Generic`, which does not have a default port.

We absorb the `ssl => true` case into this normalisation, as its previous
implementation prevented the use of non-default ports in the array provided
to `hosts`.

We also add support for IPv6 addresses, requiring a square-bracketed notation
(see: RFC2732)

Supersedes: logstash-plugins#104
Resolves:   logstash-plugins#110
Resolves:   logstash-plugins#111
yaauie added a commit to yaauie/logstash-filter-elasticsearch that referenced this issue Mar 27, 2019
An upstream bug in the Elasticsearch Ruby Client's handling of `String` host
arguments that begin with a schema (e.g., `https://localhost`) causes it to
default to port 80 or 443, depending on the schema, instead of Elasticsearch's
port 9200.

Since the Elasticsearch Ruby Client will accept a `URI` in this case, and will
correctly handle falling through to appropriate defaults, we normalise to
`URI::Generic`, which does not have a default port.

We absorb the `ssl => true` case into this normalisation, as its previous
implementation prevented the use of non-default ports in the array provided
to `hosts`.

We also add support for IPv6 addresses, requiring a square-bracketed notation
when used in conjunction with a specified port.
(see: RFC-3986)

Supersedes: logstash-plugins#104
Resolves:   logstash-plugins#110
Resolves:   logstash-plugins#111
yaauie added a commit to yaauie/logstash-filter-elasticsearch that referenced this issue Mar 27, 2019
An upstream bug in the Elasticsearch Ruby Client's handling of `String` host
arguments that begin with a schema (e.g., `https://localhost`) causes it to
default to port 80 or 443, depending on the schema, instead of Elasticsearch's
port 9200.

Since the Elasticsearch Ruby Client will accept a `URI` in this case, and will
correctly handle falling through to appropriate defaults, we normalise to
`URI::Generic`, which does not have a default port.

We absorb the `ssl => true` case into this normalisation, as its previous
implementation prevented the use of non-default ports in the array provided
to `hosts`.

We also add support for IPv6 addresses, requiring a square-bracketed notation
when used in conjunction with a specified port.
(see: RFC-3986)

Supersedes: logstash-plugins#104
Resolves:   logstash-plugins#110
Resolves:   logstash-plugins#111
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants