tomcat mapping path based configuration method sharing

  • 2020-08-22 23:17:49
  • OfStack

tomcat request header configuration

When using postman tests (with parameters) we often find a browser error :request header is too large, meaning the request header field is too long. Here you need to configure the tomcat request header length.

tomcat-service.xml


<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443" maxHttpHeaderSize ="1024000"/>

tomcat maps the hard disk path

When uploading files at development time, if the storage location is set according to the project (e.g., project name, webapp, images-ES22en, etc.), there will be a problem. The file will not show up in time after uploading. So generally our better practice is to use tomcat to map the hard disk path. The specific configuration is:

tomcat-service.xml


<Context docBase="D:\img\" path="/cloud/img/"/>

This sentence means: visit localhost: 8080 / cloud/img / 1. jpg access is actually D: \ img \ 1. jpg file


Related articles: