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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:22:48+00:00 2026-06-13T23:22:48+00:00

I have a simple application that I run using node.js. Below is my server.js:

  • 0

I have a simple application that I run using node.js. Below is my server.js:

var myApp = require('./lib/myapp')
new myApp({
port: 8000
 });

I can access the application at http://myserver.com:8000

I would like to set it up, so I can access it using https://myserver.com

I have tried various methods answered in questions asked here, but I am unable to get it working. I think the way application is being initialized is the reason, but I am not sure about that.

I know I can put it behind Apache, but I would like to do it using node.

If anyone can modify this server.js for me, that would be a great help!

Thanks

Noman A.

  • 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-13T23:22:49+00:00Added an answer on June 13, 2026 at 11:22 pm

    Thanks everyone for their contribution to this question. I really appreciate all the pointers!

    Special mention to JohnnyHK, whose suggestion got me on track. I was able to resolve my issue using node-http-proxy. Simple and effective! Below is how my server.js looks like now:

    var MyApp = require('./lib/app');
    var fs = require('fs'),
        http = require('http'),
        https = require('https'),
        httpProxy = require('http-proxy');
    
    var options = {
      https: {
        key: fs.readFileSync('certs/server.key', 'utf8'),
        cert: fs.readFileSync('certs/server.crt', 'utf8'),
        ca: fs.readFileSync('certs/ca.crt', 'utf8')
      },
      target: {
        https: true // This could also be an Object with key and cert properties
      }
    };
    
    var app = new MyApp({
        port: 8080
      });  
    
    var proxy = new httpProxy.HttpProxy({
      target: {
        host: 'localhost', 
        port: 8080
      }
    });
    https.createServer(options.https, function (req, res) {
      proxy.proxyRequest(req, res)
    }).listen(443);
    

    Thanks to everyone one again!

    -Noman A.

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

Sidebar

Related Questions

Using Netbeans 6.8 and metro 2.0 I have written a simple application that makes
I have a very simple command line Java application that I wish to port
I have a fairly simple iPhone application that I want to have run on
I have a simple Application built using Mono on Ubuntu that prints out the
I have a simple application that loads an unmanaged dll and passes a few
I have a simple c++ application that generates reports on the back end of
I have a simple WPF application that uses ClickOnce to handle installing. Within this
I have a simple iPhone application that is very similar to the Page Control
I have a simple Android application that uses a JAR I have built. When
I have a simple test application (C# console application) that does an HTTP GET

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.