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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:53:57+00:00 2026-05-27T18:53:57+00:00

My setup is something like this: [Apache running on port 80] http://domain1/ —> https://domain1/

  • 0

My setup is something like this:

[Apache running on port 80]
http://domain1/  --->   https://domain1/   (redirect using apache)
http://domain2/  --->   Hosted on apache.

and

[Nodejs running on port 443]
https://domain1/ --->   App on Express.js/Node.js

What I want now is that any requests to https://domain2/ should be denied connection.

My ssl certificate is only valid for domain1. So, I cannot do something like this:

var vhostController = express.createServer({key:privateKey,cert:certificate});
vhostController.use(express.vhost('domain1',mainApp));
vhostController.use(express.vhost('domain2',function(req, res) {res.end();}));
vhostController.listen(443);

The above code works for http, but not for https, because it tries to validate the server certificate before passing to the function which handles what to return.

So, is there some way to check before the certificate error that the request was for domain2, and deny/close the connection.

  • 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-27T18:53:57+00:00Added an answer on May 27, 2026 at 6:53 pm

    This problem has 2 solutions:

    1. Using different IPs: Works everywhere.
    2. Using SNI: Does not require different IPs, but does not work in all clients (more info at https://sni.velox.ch/).

    Using different IPs:

    I ended up using this method. Sample Code:

    var app = express.createServer({key:privateKey,cert:certificate});
    // setup app..
    app.listen(443,IP1);
    

    And I don’t run anything on IP2 on port 443. So, any connection to IP2 is rejected.

    Using SNI:

    If someone wants to use SNI, details about using it with nodejs can be found here:

    http://nodejs.org/docs/latest/api/tls.html#event_secureConnection_

    In the secureConnection event of tls server, a cleartextStream variable is passed, in which, if the client supports SNI, cleartextStream.servername gives the server domain wanted by the client. It can be checked here and appropriate action can be taken.

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

Sidebar

Related Questions

My setup is something like this: radiobutton1 - selection1 radiobutton2 - selection2 textinput1 I
I have a setup looking something like this: def foo_decorator(function): @wraps(function) def decorator(*args, **kwargs):
I'm running Vista 64 box, and attempting to setup Joomla using IIS7 (I like
I've got a setup with Apache + mod_wsgi running django code, and I'd like
http://jsfiddle.net/jENDR/3/ Something like this var test = {a: 'a', b: 'b'}; var test2 =
I have something like this set up: class CategoryPage (webapp.RequestHandler): def get(self): ** DO
I currently have my PHP class variables set up like this: class someThing {
I am trying to setup some decorators so that I can do something like:
I'm running my own LAMP server locally. Something i need to setup? Should it
I have a code setup something like below, the image is part of a

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.