mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[es] set default port based on protocol (#21564)
* [es] set default port based on protocol * explicit https/http check * url parses port as string * breaking changes docs * remove 9200 fallback
This commit is contained in:
parent
20b9cba02a
commit
cc10fc02f6
3 changed files with 34 additions and 1 deletions
|
@ -65,3 +65,10 @@ considered unique based on its persistent UUID, which is written to the path.dat
|
|||
*Details:* Any timezone can now be specified by canonical id.
|
||||
|
||||
*Impact:* The logging.useUTC flag will have to be replaced with a timezone id. If set to true the id is `UTC`.
|
||||
|
||||
[float]
|
||||
=== kibana.yml setting `elasticsearch.url` sets port based on protocol
|
||||
*Details:* In prior versions of Kibana, if no port was specified in `elasticsearch.url` a default of 9200 was chosen.
|
||||
The port is now protocol dependent: https ports will use 443, and http ports will use 80.
|
||||
|
||||
*Impact:* If your `elasticsearch.url` was dependent on an unspecified port set to 9200, `:9200` will have to be appended to the url.
|
||||
|
|
|
@ -123,6 +123,29 @@ describe('plugins/elasticsearch', function () {
|
|||
const config = parseConfig(serverConfig, { ignoreCertAndKey: true });
|
||||
expect(config.ssl.passphrase).to.be(undefined);
|
||||
});
|
||||
|
||||
describe('port', () => {
|
||||
it('uses the specified port', () => {
|
||||
const config1 = parseConfig(serverConfig);
|
||||
expect(config1.host.port).to.be('9200');
|
||||
|
||||
serverConfig.url = 'https://localhost:555';
|
||||
const config2 = parseConfig(serverConfig);
|
||||
expect(config2.host.port).to.be('555');
|
||||
});
|
||||
|
||||
it('uses port 80 if http and no specified port', () => {
|
||||
serverConfig.url = 'http://localhost';
|
||||
const config2 = parseConfig(serverConfig);
|
||||
expect(config2.host.port).to.be('80');
|
||||
});
|
||||
|
||||
it ('uses port 443 if https and no specified port', () => {
|
||||
serverConfig.url = 'https://localhost';
|
||||
const config2 = parseConfig(serverConfig);
|
||||
expect(config2.host.port).to.be('443');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -35,9 +35,12 @@ export function parseConfig(serverConfig = {}, { ignoreCertAndKey = false } = {}
|
|||
};
|
||||
|
||||
const uri = url.parse(serverConfig.url);
|
||||
const httpsURI = uri.protocol === 'https:';
|
||||
const httpURI = uri.protocol === 'http:';
|
||||
const protocolPort = httpsURI && '443' || httpURI && '80';
|
||||
config.host = {
|
||||
host: uri.hostname,
|
||||
port: uri.port,
|
||||
port: uri.port || protocolPort,
|
||||
protocol: uri.protocol,
|
||||
path: uri.pathname,
|
||||
query: uri.query,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue