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 7762175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:19:43+00:00 2026-06-01T14:19:43+00:00

I have an application that I have behind a reverse proxy, I would like

  • 0

I have an application that I have behind a reverse proxy, I would like for it to only listen to localhost/127.0.0.1.

I expected this to work:

app.listen(3001, 'localhost');

or

app.listen(3001, '127.0.0.1');

…but instead I get an error:

node.js:201
    throw e; // process.nextTick error, or 'error' event on first tick
          ^
TypeError: Cannot read property 'port' of null
    at Object.<anonymous> (/home/ctoledo/hive-go/go.js:204:76)
    at Module._compile (module.js:441:26)
    at Object..js (module.js:459:10)
    at Module.load (module.js:348:31)
    at Function._load (module.js:308:12)
    at Array.0 (module.js:479:10)
    at EventEmitter._tickCallback (node.js:192:40)

Running the application without a specifying the hostname works fine, ie., app.listen(3001);.

I am running Node v0.6.14 and express@2.5.5 and have read this google groups discussion and have found this comment in Express application.js saying: “This method takes the same arguments as node’s http.Server#listen().”

Thanks for any help.

  • 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-01T14:19:45+00:00Added an answer on June 1, 2026 at 2:19 pm

    Thanks for the info, think I see the problem. This is a bug in hive-go that only shows up when you add a host. The last lines of it are:

    app.listen(3001);
    console.log("... port %d in %s mode", app.address().port, app.settings.env);
    

    When you add the host on the first line, it is crashing when it calls app.address().port.

    The problem is the potentially asynchronous nature of .listen(). Really it should be doing that console.log call inside a callback passed to listen. When you add the host, it tries to do a DNS lookup, which is async. So when that line tries to fetch the address, there isn’t one yet because the DNS request is running, so it crashes.

    Try this:

    app.listen(3001, 'localhost', function() {
      console.log("... port %d in %s mode", app.address().port, app.settings.env);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this application that requires the creation of TreeMap<>() and this map only
I have web application that is behind a proxy. If the user has logged
I have a web application that will need to access code behind methods as
I have an application that works like a virtual desktop, with a toolbar with
So I have an application that connects to our SQLServer. This works on any
I have a Silverlight application that needs to scroll some data (like stock information)
I have a native application written in C++. I would like to write an
I'm currently developing a GUI for a Java-application that I've created. I would like
I have a ColdFusion application that's behind an ISA Server. Part of the application
I have an application that plays back video frame by frame. This is all

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.