]
Tomaz Cerar commented on WFLY-4204:
-----------------------------------
as you can see in stack trace predicate put into account (see PredicateHandler in
stacktrace) and problem is with your regular expression which fails the matcher.
Add predicate support for response-header filter
------------------------------------------------
Key: WFLY-4204
URL:
https://issues.jboss.org/browse/WFLY-4204
Project: WildFly
Issue Type: Feature Request
Components: Web (Undertow)
Affects Versions: 8.2.0.Final
Reporter: Dino Tsoumakis
Assignee: Stuart Douglas
Priority: Minor
gzip filter has predicate support. response-header filter seems to ignore predicates.
It would be great to add predicate support to the response-header filter in the same way
as it is working for gzip filter. Thus it would be possible to set response-header values
dependent on other header values. This is interesting for setting a correct
"Vary:" header value.
If using the predicate
{code}
predicate="regex[pattern='(?:application/javascript|text/css|text/html)(;.*)?',
value=%{o,Content-Type}, full-match=true]"
{code}
for filter-ref of a response-header filter request result in a 500 error producing the
following stack trace in the log:
{code}
^[[0m^[[31m17:05:15,286 ERROR [io.undertow.request] (default I/O-1) Blocking request
failed HttpServerExchange{ GET /}: java.lang.NullPointerException
at java.util.regex.Matcher.getTextLength(Matcher.java:1283) [rt.jar:1.8.0_25]
at java.util.regex.Matcher.reset(Matcher.java:309) [rt.jar:1.8.0_25]
at java.util.regex.Matcher.<init>(Matcher.java:229) [rt.jar:1.8.0_25]
at java.util.regex.Pattern.matcher(Pattern.java:1093) [rt.jar:1.8.0_25]
at
io.undertow.predicate.RegularExpressionPredicate.resolve(RegularExpressionPredicate.java:41)
at
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:24)
at
io.undertow.server.handlers.encoding.EncodingHandler.handleRequest(EncodingHandler.java:66)
at io.undertow.server.handlers.RequestLimit.handleRequest(RequestLimit.java:103)
at
io.undertow.server.handlers.RequestLimitingHandler.handleRequest(RequestLimitingHandler.java:81)
at
io.undertow.server.handlers.NameVirtualHostHandler.handleRequest(NameVirtualHostHandler.java:57)
at
io.undertow.server.handlers.error.SimpleErrorPageHandler.handleRequest(SimpleErrorPageHandler.java:76)
at
io.undertow.server.handlers.CanonicalPathHandler.handleRequest(CanonicalPathHandler.java:43)
at
io.undertow.server.handlers.ChannelUpgradeHandler.handleRequest(ChannelUpgradeHandler.java:158)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:177)
at
io.undertow.server.protocol.http.HttpReadListener.handleEventWithNoRunningRequest(HttpReadListener.java:156)
at
io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:91)
at
io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:45)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
[xnio-api-3.2.2.Final.jar:3.2.2.Final]
at
org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
[xnio-api-3.2.2.Final.jar:3.2.2.Final]
at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:87)
[xnio-nio-3.2.2.Final.jar:3.2.2.Final]
at org.xnio.nio.WorkerThread.run(WorkerThread.java:539)
[xnio-nio-3.2.2.Final.jar:3.2.2.Final]
{code}