Skip to content

Format IPv6 hostnames#565

Open
jpelletier412 wants to merge 1 commit intoopensearch-project:mainfrom
jpelletier412:fix_ipv6_report_definition
Open

Format IPv6 hostnames#565
jpelletier412 wants to merge 1 commit intoopensearch-project:mainfrom
jpelletier412:fix_ipv6_report_definition

Conversation

@jpelletier412
Copy link
Copy Markdown

Description

Fixes issue where an error is thrown when attempting to create a report definition when using IPv6 hostname. Validation of the create definition URL fails because no square brackets are around the hostname when also defining a port.
If server.host is set to "::", the URL is then constructed as "https://:::5601/". This is not a valid IPv6 URL and should be "https://[::]:5601/".
The fix is to add those brackets around the hostname when dealing with an IPv6 hostname.

Issues Resolved

#490

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Jay Pelletier <jpelletier@titaniumplatform.com>

Signed-off-by: Jay Pelletier <143456153+jpelletier412@users.noreply.github.com>
@apigeontx
Copy link
Copy Markdown

apigeontx commented Aug 15, 2025

We had the same issue with the Reporting plugin on system with IPv6. We had to modify the file server/routes/reportDefinition.ts and server/routes/report.ts by replacing:

report.report_definition.report_params.core_params.origin = `${protocol}://${hostname}:${port}${basePath}`;

by

//Since hostname is used with a port, if hostname is IPv6 format it will need to be
//surrounded by brackets per protocol rules
if (hostname?.includes(":")) {
  report.report_definition.report_params.core_params.origin = `${protocol}://[${hostname}]:${port}${basePath}`;
}
else {
  report.report_definition.report_params.core_params.origin = `${protocol}://${hostname}:${port}${basePath}`;
}

@aggarwalShivani
Copy link
Copy Markdown

Hi, this issue impacts us too.
Is there a plan to review this fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants