Httpclient request Error

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.