在 apache 上部署的 Spring Boot 应用程序雄猫9 拒绝大于19kb的post请求。
这bookController:
@CrossOrigin(origins = "*", maxAge = 3600)
@RestController
@RequestMapping("/api/v1/book")
@AllArgsConstructor
public class BookController {
private final static Logger logger = LoggerFactory.getLogger(BookController.class);
private final BookServices bookServices;
private final BookRepository bookRepository;
@PostMapping("/add") @ResponseStatus(code = HttpStatus.CREATED)
public void addBook(@Valid @RequestBody BookModel bookModel) throws SanprException {
try {
logger.info("success...");
bookServices.addBook(bookModel);
} catch (Exception e) {
StringBuilder message = new StringBuilder("Failed...");
throw new SanprException(message.toString(), e, Boolean.FALSE, Boolean.TRUE);
}
}
}
这书籍模型班级 :
@Data
@NoArgsConstructor
@AllArgsConstructor
public class BookModel {
@Id
private long id;
private String title;
private boolean isPublish;
private boolean isDuplicated;
private MediaModel background;
private String pdfFile;
private String description;
private List<TableContentsModel> tableContents;
private GlobalReferentialModel level;
private GlobalReferentialModel type;
}
这是我的服务器.xmlApache Tomcat 的配置,
<Connector port="8010"
protocol="HTTP/1.1"
compression="on"
compressionMinSize="2048"
maxPostSize="26214400" maxHttpHeaderSize="26214400"
maxSavePostSize="-1"
URIEncoding="UTF-8"
address="*.*.*.*"
redirectPort="8443"
useIPVHosts="true" />
<Connector SSLEnabled="true"
acceptCount="100" clientAuth="false"
disableUploadTimeout="true" enableLookups="false"
maxThreads="25" port="8443"
connectionTimeout="20000" maxSwallowSize = "-1"
maxHttpHeaderSize="819200"
keystoreFile="....keystore" keystorePass="****"
protocol="org.apache.coyote.http11.Http11NioProtocol" scheme="https"
secure="true" sslProtocol="TLS" compression="on" SSSLVerifyClient="none" />
截图如下邮差测试: