mo7ty commented on issue #429: Consider the outermost proxy in X-Forwarded-Host
URL: https://github.com/apache/cxf/pull/429#issuecomment-403107325
 
 
   Hi @reta,
   
   >  @mo7ty would you mind please to add test case(s) for this fix?
   
   Since this is related with the use of the option 
"_use-x-forwarded-headers_", my first intencion was to improve (reproduce the 
issue and validate the fix) any existing test introduced under the scope of the 
following changes:
   
   * [CXF-5937 - CXF Servlets should optionally react to X-Forwarded 
headers](https://issues.apache.org/jira/browse/CXF-5937)
     * [[CXF-5937] Updating AbstractHttpServlet to optionally support 
X-Forwarded 
headers](https://github.com/apache/cxf/commit/8bcb5133c602b1cbe642cfd5fbb46099a28b3016)
   * [CXF-7485 - Reverse proxy url is not reflected in Swagger UI 
response](https://issues.apache.org/jira/browse/CXF-7485)
     * [[CXF-7485] Better support for X-Forwarded-* 
headers](https://github.com/apache/cxf/commit/66e5cca3ccd0857ec9abc0e4c4fa70115ad5ac75)
   
   ... and seems that there is none that specifically tests the behavior of a 
server for requests with `X-Forwarded-*` headers.
   
   I'm able to reproduce&validate this in a web app (_private_ SOAP Web 
Service: Spring Boot + Apache Camel CXF), sit behind two Apache/httpd reverse 
proxies with `ProxyPreserveHost On`, and:
   
   ```java
   @ImportResource({ "classpath:META-INF/cxf/cxf.xml" })
   @SpringBootApplication
   public class Application extends SpringBootServletInitializer {
   ...
       @Bean
       public ServletRegistrationBean cxfServlet() {
           CXFServlet serverServlet = new CXFServlet();
           ServletRegistrationBean cxfRegBean = new 
ServletRegistrationBean(serverServlet,
                                                                            
"/mywebservice/*");
   
           Map<String,String> params = new HashMap<>();
           params.put("use-x-forwarded-headers", "true");
   
           cxfRegBean.setInitParameters(params);
   
           return cxfRegBean;
       }
   ...
   ```
   The crash I've reported previously happens when the app attempts to create 
the WSDL for the exposed web service - building the endpoint URL.
   
   Sorry, but unfortunately, I don't know if I'll be able to quickly create a 
specific test for this scenario (due to professional and familiar reasons - 
same reason for my delay in answering).
   
   - [ ] Would anyone be interested in creating tests for this feature?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to