Forum Discussion
Manipulating origin response
For example, say I have an origin server that is handing out a bogus Cache-Control header, and I want to be able to "fix" it BEFORE it hits the WAM and any caching decisions are made, so that WA would obey my "fixed" header.
Is there some kind of "flow" documented showing the order that the rules get processed (ie clientside, serverside, etc)? That might be helpful.
- rb1980_75708
Nimbostratus
This has come up for me again... this time I need to "scrub" some unique data in the origin reponse, cache it, and put something else back in it's place on the way out.
Where in here does stuff get sent to WAM? Is there a way to mess with the "priority" to get at it before it goes to cache?May 5 13:29:33 local/tmm1 info tmm1[5096]: Rule events : CLIENT_ACCEPTED May 5 13:29:33 local/tmm1 info tmm1[5096]: Rule events : HTTP_REQUEST May 5 13:29:33 local/tmm1 info tmm1[5096]: Rule events : HTTP_CLASS_SELECTED May 5 13:29:33 local/tmm1 info tmm1[5096]: Rule events : SERVER_CONNECTED May 5 13:29:33 local/tmm1 info tmm1[5096]: Rule events : HTTP_REQUEST_SEND May 5 13:29:33 local/tmm1 info tmm1[5096]: Rule events : HTTP_RESPONSE
- It depends on the version. In versions 9.4.x there is an internal iRule that needs to be edited support should be contacted if you need to do this. In versions 10.x the http_response event fires on the response from the origin and can be used to modify data prior to reaching WA.
- rb1980_75708
Nimbostratus
Thanks, Dawn. I'm working on 10.x. - rb1980_75708
Nimbostratus
Let me explain more on what I am trying to do: maybe someone can help...I have a legacy application that I want to put behind cache.
I'm ignoring the sessionKey query parameter in the policy, so pages will get cached, but then then when user B comes along and gets the page from cache, it contains user A's sessionKey.
Originally I was thinking of an iRule that would strip out the sessionKey and replace it with a token, then put a new sessionKey in, but then I realized it would be easier to just change the origin to hand out a token in place of the sessionKey. So now I need an irule to replace the token with the sessionKey from the request query parameter on the response... AFTER cache.
I took the cookie/ssn scrubbing rule on DC and modified for my case, and it works to do the replacement, but since it happens on HTTP_RESPONSE (pre WAM as Dawn pointed out), the page is getting cached with the new sessionKey. Not exactly what I want.
Is there ANY way to accomplish this?
- Thanks for providing more clarification on what you're looking to do. There are 2 potential ways to do this. Within the assembly tab in the policy there is an option called "Parameter Value Substitution" that may work. Otherwise you will need to use a VIP targeting VIP configuration in order to modify the response after it has been cached as there is currently no iRule event to trigger on the response from the WebAccelerator.
- rb1980_75708
Nimbostratus
Oh wow, the "Parameter Value Subsititution" is exactly what I need to do. (I never looked at that feature before!!) - rb1980_75708
Nimbostratus
PS: I did try the Parameter Value Substitution on the policy and it didn't seem to work for these links.http://api.mydomain.com:8080/getpage?format=xml&countryCode=US&sessionKey=foobarblah&maxResults=10&startPosition=10
- rb1980_75708
Nimbostratus
haha. Deja Vu.... I just ran across one of your old posts that addresses the vip-targeting-vip: - rb1980_75708
Nimbostratus
SUCCESS! I got it working with the vip-targeting-vip as you suggested. Thanks for the nudge in the right direction!I do have one more thing maybe you can help clarify:
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com