Skip to content

Commit

Permalink
CXF handles the X-Forwarded-* headers during WSDL generation
Browse files Browse the repository at this point in the history
  • Loading branch information
vicziani committed Jun 9, 2023
1 parent 152aa37 commit 65553df
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [3.0.0]

- Upgrade to Spring 3.1.0 and CXF 4.0.1
- CXF handles the `X-Forwarded-*` headers during WSDL generation

## [2.0.1]

Expand Down
10 changes: 10 additions & 0 deletions src/main/java/com/learnwebservices/LearnWebservicesApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
import org.apache.cxf.Bus;
import org.apache.cxf.ext.logging.LoggingFeature;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand All @@ -23,6 +25,7 @@

import jakarta.xml.ws.Endpoint;
import java.util.List;
import java.util.Map;


@SpringBootApplication
Expand Down Expand Up @@ -78,4 +81,11 @@ public FilterRegistrationBean<CorsFilter> corsFilter(CorsProperties corsProperti
return bean;
}

@Bean
public ServletRegistrationBean<CXFServlet> cxfServlet() {
ServletRegistrationBean<CXFServlet> servletRegistrationBean = new ServletRegistrationBean<>(new CXFServlet(), "/services/*");
servletRegistrationBean.setInitParameters(Map.of("use-x-forwarded-headers", "true"));
return servletRegistrationBean;
}

}

0 comments on commit 65553df

Please sign in to comment.