diff --git a/CHANGELOG.md b/CHANGELOG.md index f0ebbf4..7f93780 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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] diff --git a/src/main/java/com/learnwebservices/LearnWebservicesApp.java b/src/main/java/com/learnwebservices/LearnWebservicesApp.java index 0230674..5877082 100644 --- a/src/main/java/com/learnwebservices/LearnWebservicesApp.java +++ b/src/main/java/com/learnwebservices/LearnWebservicesApp.java @@ -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; @@ -23,6 +25,7 @@ import jakarta.xml.ws.Endpoint; import java.util.List; +import java.util.Map; @SpringBootApplication @@ -78,4 +81,11 @@ public FilterRegistrationBean corsFilter(CorsProperties corsProperti return bean; } + @Bean + public ServletRegistrationBean cxfServlet() { + ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean<>(new CXFServlet(), "/services/*"); + servletRegistrationBean.setInitParameters(Map.of("use-x-forwarded-headers", "true")); + return servletRegistrationBean; + } + }