How can I set relaxedQueryChars
for Spring Boot embedded Tomcat?
The connector attribute described here, but Spring Boot documentation has no such param
If you are using Spring Boot 2.x then you need to use WebSeerverFactoryCustomizer as given below.
@Bean
public WebServerFactoryCustomizer
containerCustomizer(){
return new EmbeddedTomcatCustomizer();
}
private static class EmbeddedTomcatCustomizer implements WebServerFactoryCustomizer {
@Override
public void customize(TomcatServletWebServerFactory factory) {
factory.addConnectorCustomizers((TomcatConnectorCustomizer) connector -> {
connector.setAttribute("relaxedPathChars", "<>[\\]^`{|}");
connector.setAttribute("relaxedQueryChars", "<>[\\]^`{|}");
});
}
}