Hi Wang, A second application (nginx) is involved here. The problem can be related to nginx, nginx received a http traffic on 10001 in access log does not mean that if forwards exactly the same original http request. Probably some configuration needs to be changed there. You should take a look in the nginx documentation about port forwarding.
You may also skip using nginx and mapping port 10001 directly to tomcat port 8080. In your browser typing your http://domain:10001, to check the getServerPort() value. This will help you to investigate if it is a Tomcat issue or not. Best regards, Hua On Thu, Jan 6, 2022 at 6:39 AM 王 静凯 <ly...@outlook.com> wrote: > Sorry for my poor English. > I re-explain the problem: > > I mean the nginx listening on port 80 and tomcat listening on 8080. > So the visitors in the LAN can use 80 to visit my website. > Then the port 80 make a port mapping to port 10001. > So the visitors use 10001 to visit my website via internet. > At this time the browser send the Host header with value ‘domain:10001’. > The nginx print the correct value ‘domain:10001’ in nginx access log. > The jsp print the correct value ‘domain:10001’ when I use > httpServletRequest.getHeader(“Host”). > According to the definition of ‘getServerPort()’, it should return 10001 > but now it return 80. > What’s more, the port 80 not relate to nginx, just bcz I am using the http > protocol. > > In another server I found one more situation. > The server has an internet IP and Tomcat listening 8080 and nginx > listening 81. > So there are no port mapping. > The visitors use ‘http://domain:81’ to visit the website. > At this time getServerPort() still return 80. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > >