Skip to content
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

AV-231513 HTTPRoute Rewrite Filter #1662

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

pkoshtavmware
Copy link
Contributor

@pkoshtavmware pkoshtavmware commented Feb 27, 2025

AV-231513 HTTPRoute Rewrite Filter

@@ -350,6 +350,13 @@ func (o *AviObjectGraph) BuildHTTPPolicySet(key string, vsNode *nodes.AviEvhVsNo
utils.AviLog.Infof("key: %s, msg: Attached HTTP redirect policy to vs %s", key, vsNode.Name)
return
}
isUrlRewritePresent := o.BuildHTTPPolicySetHTTPRequestUrlRewriteRules(key, httpPSName, vsNode, routeModel, rule.Filters, index)
if isUrlRewritePresent {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RequestHeader and ResposeHeader modifier add, remove, modify headers of request / response. URLRewriteFilter works on path and hostname. These filters seems to be compatible with each other. Do we want to skip processing those?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was an older code. Have updated the recent code without skipping


func (o *AviObjectGraph) BuildHTTPPolicySetHTTPRequestUrlRewriteRules(key, httpPSname string, vsNode *nodes.AviEvhVsNode, routeModel RouteModel, filters []*Filter, index int) bool {
urlRewriteAction := &models.HTTPRewriteURLAction{}
isUrlRewritePresent := false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: We can avoid this variable by returning true or false.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the variable altogether

@pkoshtavmware pkoshtavmware force-pushed the AV-231513-master branch 3 times, most recently from fd4862d to 6490c68 Compare March 5, 2025 09:52
Copy link
Contributor

@akshayhavile akshayhavile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pkoshtavmware Changes looks good to me.
We should add few test cases:

  1. Ingestion test case to validate urlRewrite (This will validate our Validation logic)
  2. GraphLayer test case/ FT test cases where we only mention one of the urlrewrite filter (hostname/path) and check what is the behaviour.

@pkoshtavmware
Copy link
Contributor Author

pkoshtavmware commented Mar 9, 2025

@pkoshtavmware Changes looks good to me. We should add few test cases:

  1. Ingestion test case to validate urlRewrite (This will validate our Validation logic)
  2. GraphLayer test case/ FT test cases where we only mention one of the urlrewrite filter (hostname/path) and check what is the behaviour.

@akshayhavile Added unit testcases in ingestion graph and status layer. However, validation is added in the status layer since we have recently moved httproute validation to ingestion layer

@pkoshtavmware
Copy link
Contributor Author

build ako

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request open-for-review Pull request is up for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants