Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7990689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:05:19+00:00 2026-06-04T13:05:19+00:00

I am working on an app with communicates with our server. There is a

  • 0

I am working on an app with communicates with our server. There is a bug in one of the libraries on the server side. This bug makes it a requirement to send the port along with the host.

The problem is that when I am sending a request the port seems to be striped out. I was originally using HTTPClient and setting the header like so

httpClient.addHeader(new BasicHeader("Host", "company.net:80"));

but server side they only received “company.net”

I also tried using an requestInterceptor like so

        httpClient.addRequestInterceptor(new HttpRequestInterceptor() {

            public void process(
                    final HttpRequest request,
                    final HttpContext context) throws HttpException, IOException {
                request.setHeader("Host", "company.net:80");
                Log.i(TAG, "intercepted and set host header");
            }
        });

But alas, the same problem occurred.

My final attempt was to use URLConnection instead of httpClient

    urlConnection.addRequestProperty("Host", "company.net:80");

You can probably guess the outcome.

How do I send the host including the port?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T13:05:21+00:00Added an answer on June 4, 2026 at 1:05 pm

    This seems to be the default behavior of HttpClient (see here) in that it sets the host header to the host you are actually sending it to right before it sends the request. Since port 80 is the default HTTP port, it doesn’t include it in its version of Host. You could try the method in the link and see if that does it for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on an iPhone App which communicates with a Server to store
I did heroku create and pushed a working rails app to the server. Everything
I'm working on an app that communicates with Google App Engine to update and
I'm working on a largely navigation-based iPhone app that communicates with a REST API
I'm working on an installer for our application. The installer makes some changes to
I'm working on a Ruby on Rails/PostgreSQL web app that a mobile device communicates
I am working on a Ruby on Rails app that communicates with RackSpace cloudfiles
I am working on an iPad app that has a main view (In this
I am currently working on a mobile app that is going to communicate with
Up until yesterday I had a perfectly working app on my iPhone. I made

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.