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

  • Home
  • SEARCH
  • 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 4626552
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:26:14+00:00 2026-05-22T03:26:14+00:00

I have our first NodeJS server that’s being deployed to a client server along

  • 0

I have our first NodeJS server that’s being deployed to a client server along with the rest of the application. I have a few items that need to be configured on a server-specific basis but I’m unable to find any easy way to handle this.

On googling I’ve found a few choices – using a framework that has support built in (too late), setting up a configuration file that can be loaded (would work, but I don’t want to have to worry about keep one config file for each server we have and keeping those out of git).

I’d love to just have node determine what the request domain is (dev.ourdomain vs http://www.ourdomain) and just do a condition. It sounds easy, it likely IS easy, but I’m having trouble finding any way to determine that domain data.

  • 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-05-22T03:26:15+00:00Added an answer on May 22, 2026 at 3:26 am

    As @drachenstern mentioned, you could use request.headers.host, as in:

    # get the path portion of the URI without optional port
    var domain=request.headers.host.replace(/\:\d+$/,''); 
    

    but this wouldn’t provide a canonical domain if the request was made using an IP address rather than the server’s name.

    A better option might be to use the hostname of the server, as in:

    var domain=process.env[
      process.env['OS'] && process.env['OS'].match(/^Win/) ? 'HOSTNAME' : 'HOST'
    ];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have an issue on our page whereby the first time a button posts
We don't currently have our SQL Server objects in any form of source control.
We have a setup here that is less than ideal, We have our webserver
We have developed our website(Business users website) in .net Framework 2.0 Our client us
In our team we came up with the idea that we have to do
We are rolling out our first .net 4.0 entity framework application and are having
So, I have an app that uses a SQL Server express db. I have
We have our own ORM we use here, and provide strongly typed wrappers for
We have our domain model declared in rusty old hbm files, we wish to
We have our JBoss and Oracle on separate servers. The connections seem to be

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.