fix(ui): preserve bracketed IPv6 hosts in sidecar redirect URLs (#5538)

Preserve the bracketed IPv6 Host literal when replacing the request
port with the published UI sidecar port. Cover the public status method
and both HTTP status routes without starting a Docker sidecar.

Signed-off-by: Liu Jie <maxazure@gmail.com>
This commit is contained in:
Liu Jie authored and GitHub committed 2026-10-13 23:15:09 -05:00
1 parent 255162654f
commit 5a90be1049
3 files changed
+138

No files matched your search

@@ -63,6 +63,13 @@ public class UiController {
private static String redirectUrl(String host, int port) {
String hostname = (host == null || host.isBlank()) ? "localhost" : host;
int colon = hostname.indexOf(':');
if (hostname.startsWith("[")) {
int closingBracket = hostname.indexOf(']');
if (closingBracket == hostname.length() - 1
|| (closingBracket >= 0 && hostname.charAt(closingBracket + 1) == ':')) {
colon = hostname.indexOf(':', closingBracket + 1);
}
}
if (colon >= 0) {
hostname = hostname.substring(0, colon);
}