-
Notifications
You must be signed in to change notification settings - Fork 69
fix: IPv6 host support #4367
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
base: v3.x.x
Are you sure you want to change the base?
fix: IPv6 host support #4367
Conversation
Signed-off-by: hrishikesh-nalawade <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements IPv6 host support across the APIML codebase by replacing manual URL string formatting with a centralized utility class to properly handle IPv6 addresses. IPv6 addresses require square brackets in URLs to be RFC-compliant.
- Added
UrlUtilsutility class with methods to format IPv6 addresses correctly - Updated URL construction throughout the codebase to use the new utility methods
- Added proper IPv6 address handling in route definitions and service registrations
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| common-service-core/src/main/java/org/zowe/apiml/util/UrlUtils.java | New utility class with IPv6-aware URL formatting methods |
| zaas-service/src/main/java/org/zowe/apiml/zaas/cache/CachingServiceClient.java | Replaced manual URL formatting with UrlUtils.getUrl() |
| security-service-client-spring/src/main/java/org/zowe/apiml/security/client/service/GatewaySecurityService.java | Updated login, query, and OIDC validation endpoints to use UrlUtils |
| gateway-service/src/main/java/org/zowe/apiml/gateway/services/ServicesInfoService.java | Updated base URL construction for service info |
| gateway-service/src/main/java/org/zowe/apiml/gateway/service/routing/RouteDefinitionProducer.java | Added comprehensive IPv6 handling for route definitions and external URLs |
| gateway-service/src/main/java/org/zowe/apiml/gateway/service/GatewayIndexService.java | Updated WebClient base URL construction |
| gateway-service/src/main/java/org/zowe/apiml/gateway/filters/ZaasSchemeTransformRest.java | Added hostname formatting for ZAAS requests |
| gateway-service/src/main/java/org/zowe/apiml/gateway/config/RegistryConfig.java | Updated gateway service address configuration for IPv6 |
| gateway-service/src/main/java/org/zowe/apiml/gateway/caching/CachingServiceClientRest.java | Updated caching service URL construction |
| api-catalog-services/src/main/java/org/zowe/apiml/apicatalog/swagger/api/ApiDocV3Service.java | Updated OpenAPI server URL formatting |
| api-catalog-services/src/main/java/org/zowe/apiml/apicatalog/swagger/ApiDocRetrievalServiceLocal.java | Updated SpringDoc server URL construction |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...ay-service/src/main/java/org/zowe/apiml/gateway/service/routing/RouteDefinitionProducer.java
Show resolved
Hide resolved
...ay-service/src/main/java/org/zowe/apiml/gateway/service/routing/RouteDefinitionProducer.java
Show resolved
Hide resolved
...ay-service/src/main/java/org/zowe/apiml/gateway/service/routing/RouteDefinitionProducer.java
Show resolved
Hide resolved
...ay-service/src/main/java/org/zowe/apiml/gateway/service/routing/RouteDefinitionProducer.java
Show resolved
Hide resolved
...ay-service/src/main/java/org/zowe/apiml/gateway/service/routing/RouteDefinitionProducer.java
Show resolved
Hide resolved
...ay-service/src/main/java/org/zowe/apiml/gateway/service/routing/RouteDefinitionProducer.java
Show resolved
Hide resolved
| openAPI.getServers() | ||
| .forEach(server -> server.setUrl( | ||
| String.format("%s://%s/%s", scheme, getHostname(), server.getUrl()))); | ||
| UrlUtils.getUrl(scheme, UrlUtils.formatHostnameForUrl(getHostname())) + "/" + server.getUrl())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getHostname() returns host+port, which contains ":" even if there is no IPv6 address. This will probably create an incorrect URL
| } | ||
|
|
||
| // Check if this is an IPv6 address (contains multiple colons) | ||
| if (hostname.contains(":") && !hostname.startsWith("[")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it safe to assume that any address containing ":" is IPv6? Isn't there a better validation?
Description
Code changes to support IPv6 address
Linked to #4318
Type of change
Please delete options that are not relevant.
Checklist: