There are many methods to forward user port numbers to tomcat when apache is used as a proxy server. The mod_rewrite and mod_headers modules are required. The following are the steps: www.2cto.com 1. append the reference to the above two modules in the apache configuration file. Different system methods are slightly different. [Python] LoadModule rewrite_module/usr/lib64/apache2-prefork/mod_rewrite.so LoadModule headers_module/usr/lib64/apache2-prefork/mod_headers.so 2. then, append the following rewrite configuration to the apache configuration file www.2cto.com [python] RewriteEngine on RewriteRule. *-[E = REMOTE_PORT: % {REMOTE_PORT}, NE] RequestHeader set X-Forwarded-SourcePort % {REMOTE_PORT} e 3. if a virtual host is used On apache, you need to add these two lines in each <VirtualHost> segment: [python] RewriteEngine On RewriteOptions Inherit