I have a bunch of responder policies that use StringMaps to do a 301 redirect when users try to access certain URL’s. It works great, however I must perform two bindings on the StringMap to match the path plus the same item with a trailing backslash.
What I would like to do is to create a rewrite policy to remove trailing backslashes. The problem is I am unable to find any documentation or forum posts that give me enough information to figure out how to do this.
For a starting reference point; the following is the StringMap & Responder config that I currently have. Doing a single URL is manageable, however I have thousands, and the inability to strip the trailing backslash before hitting the responder policy forces me to double the size of my StringMap.
Any assistance would be greatly appreciated. If there is no way to do what I am looking for via a rewrite or modifying my responder policy I would still be grateful with any input from the community.
Question
David Eaves
I have a bunch of responder policies that use StringMaps to do a 301 redirect when users try to access certain URL’s. It works great, however I must perform two bindings on the StringMap to match the path plus the same item with a trailing backslash.
What I would like to do is to create a rewrite policy to remove trailing backslashes. The problem is I am unable to find any documentation or forum posts that give me enough information to figure out how to do this.
For a starting reference point; the following is the StringMap & Responder config that I currently have. Doing a single URL is manageable, however I have thousands, and the inability to strip the trailing backslash before hitting the responder policy forces me to double the size of my StringMap.
add policy stringmap SM_WEB_service -comment "StringMap for service.web.com url responder policy."
bind policy stringmap SM_WEB_service "/example1" "http://www.web.com/en/example1"
bind policy stringmap SM_WEB_service "/example1/" "http://www.web.com/en/example1"
bind policy stringmap SM_WEB_service "/example2" "http://www.web.com/en/example2"
bind policy stringmap SM_WEB_service "/example2/" "http://www.web.com/en/example2"
add responder action RES-ACT_WEB_service redirect "HTTP.REQ.URL.MAP_STRING(\"SM_WEB_service\")" -bypassSafetyCheck YES -comment "Responder action to redirect user to URL."
add responder policy RES-POL_WEB_service "(HTTP.REQ.HOSTNAME.EQ(\"service.web.com\") || HTTP.REQ.HOSTNAME.EQ(\"www.service.web.com\")) && HTTP.REQ.URL.IS_STRINGMAP_KEY(\"SM_WEB_service\")" RES-ACT_WEB_service -comment "Responder policy for service.web.com URL redirection."
bind lb vserver VS-PRD_WEB -policyName RES-POL_WEB_service -priority 99 -gotoPriorityExpression END -type REQUEST
Any assistance would be greatly appreciated. If there is no way to do what I am looking for via a rewrite or modifying my responder policy I would still be grateful with any input from the community.
Link to comment
5 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now