Bug 1158381 - [GSS] (6.3.z) JBossWeb RewriteValve throws IllegalArgumentException when using 'CO' flag
Summary: [GSS] (6.3.z) JBossWeb RewriteValve throws IllegalArgumentException when usin...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Web
Version: 6.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: CR1
: EAP 6.3.3
Assignee: Tomas Hofman
QA Contact: Michael Cada
URL:
Whiteboard:
Depends On: 1158385
Blocks: eap633-payload 1157439
TreeView+ depends on / blocked
 
Reported: 2014-10-29 09:31 UTC by Masafumi Miura
Modified: 2019-08-19 12:38 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1158385 (view as bug list)
Environment:
Last Closed: 2019-08-19 12:38:41 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
JBOSSWEB_RewriteValve_CO_flag_patch.diff (1.09 KB, patch)
2014-10-29 09:36 UTC, Masafumi Miura
mmiura: review?
Details | Diff

Description Masafumi Miura 2014-10-29 09:31:32 UTC
### Description of problem:

When configuring the following RewriteValve setting using 'CO' flag:

~~~
<subsystem xmlns="urn:jboss:domain:web:2.1" default-virtual-server="default-host" native="false">
    <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
    <virtual-server name="default-host" enable-welcome-root="true">
        <alias name="localhost"/>
        <alias name="example.com"/>
        <rewrite name="rule-1" pattern="^/(.*)$" substitution="-" flags="CO=foo:bar:.example.com:60:/test">
            <condition name="condition-0" test="%{REQUEST_URI}" pattern=".*/valvetest/.*"/>
        </rewrite>
    </virtual-server>
</subsystem>
~~~

JBossWeb RewriteValve throws the following IllegalArgumentException at JBoss EAP start-up:

~~~
ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.web.host.default-host: org.jboss.msc.service.StartException in service jboss.web.host.default-host: java.lang.IllegalArgumentException: JBWEB007005: Error reading rewrite flags in line RewriteRule ^/(.*)$ - [CO=foo:bar:.example.com:100:/test] as CO=foo:bar:.example.com:100:/test
	at org.jboss.as.web.WebVirtualHostService.createRewriteValve(WebVirtualHostService.java:225)
	at org.jboss.as.web.WebVirtualHostService.start(WebVirtualHostService.java:88)
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1980) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1913) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_67]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_67]
	at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_67]
Caused by: java.lang.IllegalArgumentException: JBWEB007005: Error reading rewrite flags in line RewriteRule ^/(.*)$ - [CO=foo:bar:.example.com:100:/test] as CO=foo:bar:.example.com:100:/test
	at org.jboss.web.rewrite.RewriteValve.parseRuleFlag(RewriteValve.java:718)
	at org.jboss.web.rewrite.RewriteValve.parse(RewriteValve.java:565)
	at org.jboss.web.rewrite.RewriteValve.parse(RewriteValve.java:208)
	at org.jboss.web.rewrite.RewriteValve.setConfiguration(RewriteValve.java:184)
	at org.jboss.as.web.WebVirtualHostService.createRewriteValve(WebVirtualHostService.java:223)
	... 6 more
~~~


### How reproducible:

Anytime when configuring the RewriteValve using 'CO' flag.


### Steps to Reproduce:
1. Configure the above <rewrite> config inside web subsystem in standalone.xml
2. Start EAP 6

### Actual results:

JBossWeb RewriteValve throws IllegalArgumentException at JBoss EAP start-up.


### Expected results:

JBoss EAP starts wihtout IllegalArgumentException and the configured RewriteValve works.


### Additional info:

http://docs.jboss.org/jbossweb/7.0.x/rewrite.html says:

~~~
'cookie|CO=NAME:VAL:domain[:lifetime[:path]]' (set cookie)
This sets a cookie in the client's browser. The cookie's name is specified by NAME and the value is VAL. The domain field is the domain of the cookie, such as '.apache.org', the optional lifetime is the lifetime of the cookie in minutes, and the optional path is the path of the cookie
~~~

so 'CO' flag should work.

Comment 1 Masafumi Miura 2014-10-29 09:36:26 UTC
Created attachment 951686 [details]
JBOSSWEB_RewriteValve_CO_flag_patch.diff

Comment 8 Rémy Maucherat 2014-12-01 12:52:47 UTC
r2562 in web.

Comment 10 Radim Hatlapatka 2015-01-19 16:53:04 UTC
Verified in EAP 6.3.3.CP.CR1


Note You need to log in before you can comment on or make changes to this bug.