@Configuration public class TomcatConfig { @Bean public TomcatServletWebServerFactory webServerFactory() { TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(); factory.addConnectorCustomizers((Connector connector) -> { connector.setProperty("relaxedQueryChars", "(),/:;<=>?@[\]{}"); connector.setProperty("rejectIllegalHeader", "false"); }); return factory; } }
在项目中添加此类,然后重启