-
Notifications
You must be signed in to change notification settings - Fork 259
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 sending empty path for API resource /* when upstream has no base path #3632
Fix sending empty path for API resource /* when upstream has no base path #3632
Conversation
…path Signed-off-by: Renuka Fernando <renukapiyumal@gmail.com>
var resourceRegex string | ||
var substitutionString string | ||
if resourcePath == "/*" && endpointBasepath == "" { | ||
// If endpointBasepath is empty and resourcePath is "/*", enforce the path to be "/" to avoid setting empty path in upstream |
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.
Do we support the case where we set a "/" (not /*) to the resources? eg (GET /, PUT / ..)
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.
And also, if the client sends the "/" it should be forwarded to the backend ideally. If some backends needs the empty "/", then client can send it. Is this the way we support?
https://-dev-us-east-azure/dlif/request-info/v1.0/ -> https://bachendhost/context/
https://-dev-us-east-azure/dlif/request-info/v1.0 -> https://bachendhost/context
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.
Do we support the case where we set a "/" (not /*) to the resources? eg (GET /, PUT / ..)
Yes this is working, the only issue was with the "/*". Scenarios I've identified: https://github.com/wso2-enterprise/choreo/issues/29592#issuecomment-2572406585
And also, if the client sends the "/" it should be forwarded to the backend ideally. If some backends needs the empty "/", then client can send it. Is this the way we support?
https://-dev-us-east-azure/dlif/request-info/v1.0/ -> https://bachendhost/context/ https://-dev-us-east-azure/dlif/request-info/v1.0 -> https://bachendhost/context
When there is a context (working as expected when there is no context) in the upstream it always sends the trailing slash. i.e.
https://-dev-us-east-azure/dlif/request-info/v1.0 -> https://bachendhost/context/
This should be fixed too.
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.
Shall we fix this as well?
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.
fixed and added unit tests
Signed-off-by: Renuka Fernando <renukapiyumal@gmail.com>
[succeeded] Dataplane(NorthEU) cluster : dev-deployment-v2 : 20250107.18 |
[succeeded] Dataplane(EastUS) cluster : dev-deployment-v2 : 20250107.18 |
[succeeded] : dev-deployment-v2 : 20250107.18 |
[] Controlplane cluster : stage-deployment-v2 : 20250116.3 |
[] Dataplane(NorthEU) cluster : stage-deployment-v2 : 20250116.3 |
Purpose
Issues
Fixes https://github.com/wso2-enterprise/choreo/issues/29592
Automation tests
Tested environments
Tested running Adapter only
Maintainers: Check before merge