-
Notifications
You must be signed in to change notification settings - Fork 649
Fix incorrect gateway URL port (-1) in Dev Portal when custom tenant URL is used with HTTP-only APIs. #13066
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
Fix incorrect gateway URL port (-1) in Dev Portal when custom tenant URL is used with HTTP-only APIs. #13066
Conversation
📝 WalkthroughWalkthroughThis pull request updates the API management functionality in two components. In the API consumer implementation, the logic for processing custom URLs now checks for both HTTP and HTTPS protocols, defaulting to assign the URL to both when no valid prefix is present. In the API mapping utility, error handling is added to manage malformed custom gateway URLs, with enhancements for extracting the HTTP port and context from the provided URL. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant APIConsumerImpl
Client->>APIConsumerImpl: getHostWithSchemeMappingForEnvironment(api, org, env)
APIConsumerImpl->>APIConsumerImpl: Check if customUrl is not null
APIConsumerImpl->>APIConsumerImpl: Verify if customUrl starts with "http://" or "https://"
alt Valid prefix found
APIConsumerImpl->>APIConsumerImpl: Map customUrl to corresponding protocol
else No valid prefix
APIConsumerImpl->>APIConsumerImpl: Map customUrl to both HTTP and HTTPS
end
APIConsumerImpl-->>Client: Return protocol mapping
sequenceDiagram
participant Client
participant APIMappingUtil
Client->>APIMappingUtil: fromAPIRevisionToEndpoints(apiRevision, customGatewayUrl)
APIMappingUtil->>APIMappingUtil: Attempt to create URL from customGatewayUrl
alt URL creation error
APIMappingUtil-->>Client: Throw APIManagementException
else URL creation successful
APIMappingUtil->>APIMappingUtil: Extract HTTP port and context from URL
APIMappingUtil-->>Client: Return endpoints configuration
end
Suggested reviewers
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ast-grep (0.31.1)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConsumerImpl.javaTip ⚡️ Faster reviews with caching
Enjoy the performance boost—your workflow just got faster. 📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms (6)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
…n custom tenant URL is used with HTTP-only APIs.
851fa71
to
51c52d3
Compare
Scenario
This issue occurs when:
/customurl/api-cloud/...
)As a result:
http://example.com:-1/context/version
Fix
-1
port issue by correctly setting the port.Related Issue: wso2/api-manager#3819