AW: getServerPort always return 80

2022-01-24 Thread Thomas Hoffmann (Speed4Trade GmbH)
Hello, Maybe you can use isSecure() instead of getScheme() Issecure can be modified via server.xml Greetings, Thomas Von: 王 静凯 Gesendet: Montag, 24. Januar 2022 10:35:52 An: Tomcat Users List Betreff: 回复: getServerPort always return 80 Hi, I have found what

回复: getServerPort always return 80

2022-01-24 Thread 王 静凯
; 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%

re: getServerPort always return 80

2022-01-23 Thread 王 静凯
ed4Trade > 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%

AW: getServerPort always return 80

2022-01-21 Thread Thomas Hoffmann (Speed4Trade GmbH)
the documentation at https://tomcat.apache.org/tomcat-9.0-doc/config/ajp.html#Proxy_Support Greetings, Thomas -Ursprüngliche Nachricht- Von: 王 静凯 Gesendet: Freitag, 21. Januar 2022 07:26 An: Tomcat Users List Betreff: re: getServerPort always return 80 Hi, any other know this problem? I meet

re: getServerPort always return 80

2022-01-20 Thread 王 静凯
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.

re: re: getServerPort always return 80

2022-01-07 Thread 王 静凯
Hi Hua, I have try to modify the access log format of tomcat. Add '%{Host}i' in server.xml like this: Then it print 'domain:10001' in log, so I think nginx has passed the correct host header to tomcat. By the way, I found the valve component 'RemoteIpValve'

Re: 回复: getServerPort always return 80

2022-01-06 Thread Hua Zhang
Hi Wang, I hope that this link will help you to solve the problem: https://stackoverflow.com/questions/19751313/forward-request-headers-from-nginx-proxy-server You may check the tomcat access log to see what kind of traffic it received from nginx to confirm that your issue is related to nginx

回复: 回复: getServerPort always return 80

2022-01-06 Thread 王 静凯
Hi Hua, You are right, when tomcat listening port 80, then getServerPort return 10001. So how to resolve this problem when I use nginx as a reverse-proxy? I write in nginx config file: “proxy_set_header Host$http_host;” or “proxy_set_header Host

Re: 回复: getServerPort always return 80

2022-01-06 Thread Hua Zhang
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

回复: 回复: getServerPort always return 80

2022-01-05 Thread 王 静凯
>> Hi chris, >> >>> I use httpServletRequest.getServerPort() to get the port in my jsp. >>> When the tomcat listen 8080 and nginx listen 80. >>> Nginx has set ‘proxy_set_header Host $http_host’. >> >>> What is the value of $http_host? >> >> The $http_host is ‘externalIP:10001’ (I print it

Re: 回复: getServerPort always return 80

2022-01-05 Thread Christopher Schultz
王 静凯, On 1/5/22 01:55, 王 静凯 wrote: Hi chris, I use httpServletRequest.getServerPort() to get the port in my jsp. When the tomcat listen 8080 and nginx listen 80. Nginx has set ‘proxy_set_header Host $http_host’. What is the value of $http_host? The $http_host is ‘externalIP:10001’

回复: getServerPort always return 80

2022-01-04 Thread 王 静凯
Hi chris, > I use httpServletRequest.getServerPort() to get the port in my jsp. > When the tomcat listen 8080 and nginx listen 80. > Nginx has set ‘proxy_set_header Host $http_host’. > What is the value of $http_host? The $http_host is ‘externalIP:10001’ (I print it in access_log of nginx

Re: getServerPort always return 80

2022-01-04 Thread Christopher Schultz
王 静凯, On 1/4/22 00:46, 王 静凯 wrote: Hi, I use httpServletRequest.getServerPort() to get the port in my jsp. When the tomcat listen 8080 and nginx listen 80. Nginx has set ‘proxy_set_header Host $http_host’. What is the value of $http_host? Then the port 80 mapping to Internet via

getServerPort always return 80

2022-01-03 Thread 王 静凯
Hi, I use httpServletRequest.getServerPort() to get the port in my jsp. When the tomcat listen 8080 and nginx listen 80. Nginx has set ‘proxy_set_header Host $http_host’. Then the port 80 mapping to Internet via 10001. Use httpServletRequest.getHeader(“Host”) I can get the correct value of