RegExReplacer corrupts binary response need to be able to specify filter

22 views
Skip to first unread message

Andy Arismendi

unread,
Jan 26, 2023, 10:10:33 PM1/26/23
to membrane-monitor
Hi, I ran into an issue where the response content type is application/zip and wasn't excluded due to the limited exclusion in the code linked below which caused corruption. It would be great to be able to specify a content type list to only apply the regex to e.g. text/html, application/json etc... in proxies.xml as an attribute for RegExReplacer.

https://github.com/membrane/service-proxy/blob/b16dc34bb510c3f00ddb321fbfc74265e2b67647/core/src/main/java/com/predic8/membrane/core/interceptor/RegExReplaceInterceptor.java#L75

Tobias Polley

unread,
Jul 18, 2023, 5:52:41 AM7/18/23
to membrane-monitor
Hi Andy,

sorry for the late reply. In general, you can put any interceptor within an <if>:

<if test="exc.response.header.getFirstValue('Content-Type') != 'application/zip'">
  <rewriter>...</rewriter>
</if>

But, of course, this is far from a good solution, as the content-type might also be "application/octet-stream", or have parameters, or be missing, or ...

It might still work in your case, though.

Best
Toby
Reply all
Reply to author
Forward
0 new messages