Hi Together,
I'm using Jetty 12 with the rewrite module to modify request headers. The configuration works perfectly, but I need the request header replacement to only occur for a specific URI pattern. Note that I'm specifically working with request headers, not response headers.
Here's my current jetty-rewrite-rules.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">
<Configure id="RewriteHandler" class="org.eclipse.jetty.rewrite.handler.RewriteHandler">
<Set name="rules">
<Array type="org.eclipse.jetty.rewrite.handler.Rule">
<Item>
<New class="org.eclipse.jetty.rewrite.handler.RuleContainer">
<Set name="rules">
<Array type="org.eclipse.jetty.rewrite.handler.Rule">
<!-- Set Content-Type header -->
<Item>
<New class="org.eclipse.jetty.rewrite.handler.ForceRequestHeaderValueRule">
<Set name="headerName">Content-Type</Set>
<Set name="headerValue">application/soap+xml</Set>
</New>
</Item>
</Array>
</Set>
</New>
</Item>
</Array>
</Set>
</Configure>
The current configuration successfully replaces the Content-Type request header with application/soap+xml, but it applies to all requests.
I want to restrict this header modification to only occur when requests match a specific URI pattern, such as /soap/* or /api/v1/soap.
I don't want to use a servlet or custom filter for this, I just want to use the configuration via XML.
Is there a possibility?
Thanks!
Kind regards
Daniel Julius