Embedded Tomcat Server configuration in Spring boot application
To modify the default configuration of Spring boot embedded Tomcat server, we can make use of below properties
·
Server.port=80 If you wish to change the port
number
·
Server.address=my_custom_ip IP address where the server would listen
·
By default spring boot provides standard error
web page. This page is called white label. It’s enabled by default but if we want
to disable it using Server.error.whitelabel.enabled=false
·
Default path of whitelabel is /error but it can
be customized using Server.error.path=/user-error
·
To limit the number of simultaneous requests
made to the server, use server.tomcat.threads.max=200
·
Server connection timeout using
server.connection-timeout=5s
·
Define max size of request header server.max-http-header-size=8KB
·
Define max size of request body server.tomcat.max-swallow-size=2MB
·
Define max size of whole post request
server.tomcat.max-http-post-size=2MB
·
To enable SSL support in spring boot application
use server.ssl.enabled=true and server.ssl.protocol=TLS. Then we should also
configure keystore path and passwords
o
server.ssl.key-store-password=my_password
o
server.ssl.key-store-type=keystore_type
o
server.ssl.key-store=keystore-path
·
Tomcat server
access logs
o
Server.tomcat.accesslog.enabled=true
o
Server.tomcat.accesslog.directory=logs
o
Server.tomcat.accesslog.file-date-format=yyyy-MM-dd
o
Server.tomcat.accesslog.prefix=access_log
o Server.tomcat.accesslog.suffix=.log
Comments
Post a Comment