cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Freeman Fang (JIRA)" <>
Subject [jira] [Commented] (CXF-7160) Can not configure CXF http-jetty transport to handle X-Fowarded-for headers with Jetty 9
Date Thu, 22 Dec 2016 03:29:58 GMT


Freeman Fang commented on CXF-7160:

Hi Sergey,

Yes, CXF-7179 covered this one, I will resolve this one.

And about Jetty9 support, for CXF 3.1.x branch, IMHO an extra http-jetty9 module is too much,
how about we change the jetty server version with
and using reflect way to construct the connector? We already use this way for specific jetty
version(like we upgrade to handle jetty8 before)

About CXF 3.2 support jetty 9 only, I'm all for this as Jetty8 was EOL at end of 2014 and
no further work on jetty 8 so CXF 3.2 support jetty 9 only make a lot sense for me. I will
send mail to the dev to start discussion.

Best Regards

> Can not configure CXF http-jetty transport to handle X-Fowarded-for headers with Jetty
> ----------------------------------------------------------------------------------------
>                 Key: CXF-7160
>                 URL:
>             Project: CXF
>          Issue Type: Bug
>          Components: Transports
>    Affects Versions: 3.1.5
>            Reporter: Joe Luo
>            Assignee: Freeman Fang
> With Jetty 8, we can configure CXF http-jetty transport to handle reverse proxy headers
by simply setting "forwarded" to "true" to Jetty8 NIO SelectChannelConnector:
> {code}
> <httpj:engine-factory bus="cxf">
>     <httpj:engine port="${}">
> 	    <httpj:connector>
> 		    <bean id="connector" class="org.eclipse.jetty.server.nio.SelectChannelConnector">
> 			    <property name="port" value="${}" />                    
> 				<property name="forwarded" value="true" />                
> 			</bean>            
> 		</httpj:connector>          
> 	</httpj:engine> 
> </httpj:engine-factory>
> {code}
> However, with Jetty 9, it is not possible to do so. Because in Jetty 9, the SelectChannelConnector
was replaced by more generic purpose ServerConnector. And we can't configure ServerConnector
since the old no-args constructor does not exist anymore in ServerConnector class and all
new constructors require the org.eclipse.jetty.server.Server as an input parameter.
> Jetty 9 documentation here talked about "X-Forward-for Configuration":
> We should configure HttpConfiguration with ForwardedRequestCustomizer in order to handle
reverse proxy headers:
> {code}
> <New id="httpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
>     <Set name="outputBufferSize">32768</Set>
>     <Set name="requestHeaderSize">8192</Set>
>     <Set name="responseHeaderSize">8192</Set>
>     <Call name="addCustomizer">
>         <Arg>
>             <New class="org.eclipse.jetty.server.ForwardedRequestCustomizer"/>
>         </Arg>
>     </Call>
> </New>
> {code}
> However, CXF http-jetty transport schema is not in-sync with API changes in Jetty 9.
There is no way to configure above with CXF http-jetty transport schema.
> I can think of two solutions:
> # Just like what we did in another JIRA:
> for servlet, we should also fix CXF http-jetty
transport so we can optionally react to X-Forwarded headers;
> # Change CXF http-jetty transport schema
> and related java code to allow configuring HttpConfiguration along with ForwardedRequestCustomizer
in order to handle X-Fowarded-for headers.

This message was sent by Atlassian JIRA

View raw message