[jboss-jira] [JBoss JIRA] (WFLY-8642) rewrite handler handles references to contextual values incorrect
Markus Stier (JIRA)
issues at jboss.org
Thu Apr 27 08:17:00 EDT 2017
[ https://issues.jboss.org/browse/WFLY-8642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13399182#comment-13399182 ]
Markus Stier edited comment on WFLY-8642 at 4/27/17 8:16 AM:
-------------------------------------------------------------
I've tried your workaround, but it doesn't work. This is the error message from the log:
{code}
Cannot resolve expression 'regex('^/path/([^/]+)/(.*)/?$') -> rewrite('/newpath'); set(attribute='%{QUERY_STRING}', value='param1=${1}¶m2=${2}'); done()'
{code}
I guess it won't be sufficient to add the quotation mark as end token. Imagine a rewrite rule where one wants to compose a single value from two capture groups:
request: http://myhost.com/path/a/b/c
rewritten to: http://myhost/path?resource=a-b-c.xml
the rule would be: (... regex omitted.. ) -> rewrite ('/path'): set(attribute='%{QUERY_STRING}', value='resource=$1-$2-$3.xml').
I think you should try to get the curly braces to work.
was (Author: mrkstr):
I've tried your workaround, but it doesn't work. This is the error message from the log:
{code}
Cannot resolve expression 'regex('^/path/([^/]+)/(.*)/?$') -> rewrite('/newpath'); set(attribute='%{QUERY_STRING}', value='param1=${1}¶m2=${2}'); done()'
{code}
> rewrite handler handles references to contextual values incorrect
> -----------------------------------------------------------------
>
> Key: WFLY-8642
> URL: https://issues.jboss.org/browse/WFLY-8642
> Project: WildFly
> Issue Type: Bug
> Components: Web (Undertow)
> Affects Versions: 10.1.0.Final
> Environment: * Windows 10
> * Wildfly 10.1.0 Final
> * Undertow Subsystem 1.4.13
> Reporter: Markus Stier
> Assignee: Stuart Douglas
>
> Context:
> A URL in the form of "http://somehost.org/path/a/b" should be rewritten to "http://somehost.org/newpath?param1=a¶m2=b"
> The following filter should perform this rewrite:
> {code}
> <expression-filter name="rewrite-path" expression="regex('^/path/([^/]+)/(.*)/?$') -> rewrite('/newpath'); set(attribute='%{QUERY_STRING}', value='param1=$1&param2=$2'); done()"/>
> {code}
> Problem:
> The output is (according to access-log);
> {code}
> somehost.org "GET /newpath?param1=b
> {code}
> * param1 is assigned to the value of $2
> * param2 is dropped completly
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
More information about the jboss-jira
mailing list