I have two applications, one requesting another system through httpclient. It is good to be local. But it cannot be placed on the Linux server. The URL address is correct, but it is submitted using get. The return code is 200, but a string of HTML is obtained.Code. Submit with post. The return code is 301. It is correct to return the request in the address bar. Later, I analyzed the cause and made a low-level mistake.
First, nginx is installed on my. 10.10.10.1 server, and two Tomcat servers are installed on the 10.10.10.2 server. Nginx has configured domain name ing to Tomcat, And I have configured nginx hosts locally.
When I initiate a request from the address bar locally, the request first arrives at nginx and is originally forwarded to Tomcat.
When initiated through httpclient, it is initiated from tomcat, but nginx hosts is not configured on 10.10.10.2. As a result, the service corresponding to the domain name cannot be found. Therefore, the request failed.
After I configure hosts for the Tomcat server, it will be OK.
I would like to share with you here.