Hi, I have try proxyName and proxyPort, but the proxyPort can change nothing when proxyName can take effect.
>>> Probably your Tomcat listens on Port 80 and nginx was sending the request >>> to that port. My tomcat listen 8080 and nginx listen 81, nginx sent the request to 8080 with a host header �C ‘ip:81’ According to the definition of getServerPort : ‘It is the value of the part after ":" in the Host header value, if any’ 从 Windows 版邮件<https://go.microsoft.com/fwlink/?LinkId=550986>发送 > 发件人: Thomas Hoffmann (Speed4Trade > GmbH)<mailto:thomas.hoffm...@speed4trade.com.INVALID> > 发送时间: 2022年1月21日 20:41 > 收件人: Tomcat Users List<mailto:users@tomcat.apache.org> > 主题: AW: getServerPort always return 80 > > Hello, > according to > https://apac01.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftomcat.apache.org%2Ftomcat-8.0-doc%2Fservletapi%2Fjavax%2Fservlet%2FServletRequest.html%23getServerPort&data=04%7C01%7C%7C61784521d165411600c508d9dcdb5e00%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637783657020615549%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=CCUiWi%2Bm4ouiAHFFhtx9ohvVTYBVKbxQnFn8os0RPRE%3D&reserved=0() > it is the Port to which the request was sent to. > Probably your Tomcat listens on Port 80 and nginx was sending the request to > that port. > > For Proxy, check out the documentation at > https://apac01.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftomcat.apache.org%2Ftomcat-9.0-doc%2Fconfig%2Fajp.html%23Proxy_Support&data=04%7C01%7C%7C61784521d165411600c508d9dcdb5e00%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637783657020615549%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=aoegRGk9NEUdq6K2ks%2FBTeQKyCYiGvm65js%2BsbidLNU%3D&reserved=0 > > > Greetings, > Thomas > > -----Ursprüngliche Nachricht----- > Von: 王 静凯 <ly...@outlook.com> > Gesendet: Freitag, 21. Januar 2022 07:26 > An: Tomcat Users List <users@tomcat.apache.org> > Betreff: re: getServerPort always return 80> > > Hi, any other know this problem? I meet it again today. > A server has an Internet IP and when nginx listen to 81,the > request.getServerPort() return 80.