Spring boot application deployed on apache tomcat 9 reject post request larger than 19kb.
the 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);
}
}
}
the bookModel class :
@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;
}
here my server.xml configuration for apache 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" />
here scrrenshots on postman testing :
working : https://ibb.co/0K679Hf
not working : https://ibb.co/4JG2WSR