The Twitter and Facebook links use a tags while the DZone markup is generated by a script contained in a script tag. We will use the RegExReplaceInterceptor to remove those tags.

For each tag we want to remove we create a RegExReplaceInterceptor bean definition. You can do it with only one bean definition but than the pattern you use will be more complex. So we add the following bean definitions into our monitor-beans.xml document.

The pattern property defines the regular expression that is used. It follows standard Java RegEx Pattern syntax. Every part in the response that matches the regulare expression is replaced by the string defined by the replacement property.
We choose the patterns so that they match the a tag that points to facebook and twitter and the script tag that contains the script for DZone.

Now we need a rule configuration so that the RegExReplaceInterceptors are used. You can use the Membrane Monitor to create a rule and add the interceptors we created above to it or you can use the following rule.xml document:

Related

Hi sjayaratna, I tested this configuration and it work but I’m not sure that this solve my problem because in my scenario there is a webapp that access many url and only access specif one (like facebook and so on) need to replace in a trasparent way part of body. In other word in rules.xml I would not speficy a targethost because the rule must be applied to a pattern (ie all url that contains facebook) and more the client webapp cannot change url (or port) to access this sites. I think to a browser config. that point statically to the proxy (membrane router) and then access in a trasparent way to all urls. It’s possible ? Thanks in advance.