Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

250
Views
Why is the 'Host' header set to incorrect value upon receiving a 301 status response

I am facing an issue while using the Apache components client 4.5.5. My use case is as follows:

  1. Http-client is configured to connect to http-server1 with host1 and port 8888. Both the http-client and the server1 are running on the same machine.
  2. The http-server1 is suppose to give a 301 status code and is configured with the location pointing to http-server2 with host2 and port 8888. Http-server2 is running on a different machine.
  3. When the Http-client receives this response from server1, it creates another request with URI as mentioned in the "location" header but it still uses the host1 for the request instead of host2.
  4. As a result of this, the redirected http request fails with a 400 status code.

Please help in pointing out what might be causing this or if this is an expected behaviour to keep the host unchanged? If not then Can anyone also suggest any methods that can be used to change the host header in the second request!

Thanks in advance.

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!