-
Notifications
You must be signed in to change notification settings - Fork 644
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
base: master
Are you sure you want to change the base?
Fix incorrect gateway URL port (-1) in Dev Portal when custom tenant URL is used with HTTP-only APIs. #13066
Conversation
…n custom tenant URL is used with HTTP-only APIs.
📝 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.java📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (2)
🧰 Additional context used🧬 Code Definitions (1)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConsumerImpl.java (2)
⏰ Context from checks skipped due to timeout of 90000ms (6)
🔇 Additional comments (4)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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
|
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