Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion https problem one server, two url, two ip addresses (eth0 and eth0:0)

Received: by 10.68.135.2 with SMTP id po2mr2365994pbb.0.1351638338081;
        Tue, 30 Oct 2012 16:05:38 -0700 (PDT)
X-BeenThere: nodejs@googlegroups.com
Received: by 10.68.223.67 with SMTP id qs3ls3867437pbc.8.gmail; Tue, 30 Oct
 2012 16:05:25 -0700 (PDT)
Received: by 10.66.86.39 with SMTP id m7mr11573618paz.4.1351638325052;
        Tue, 30 Oct 2012 16:05:25 -0700 (PDT)
Received: by 10.66.86.39 with SMTP id m7mr11573617paz.4.1351638325040;
        Tue, 30 Oct 2012 16:05:25 -0700 (PDT)
Return-Path: <i...@bnoordhuis.nl>
Received: from mail-pa0-f53.google.com (mail-pa0-f53.google.com [209.85.220.53])
        by gmr-mx.google.com with ESMTPS id yl8si521951pbc.1.2012.10.30.16.05.24
        (version=TLSv1/SSLv3 cipher=OTHER);
        Tue, 30 Oct 2012 16:05:24 -0700 (PDT)
Received-SPF: pass (google.com: domain of i...@bnoordhuis.nl designates 209.85.220.53 as permitted sender) client-ip=209.85.220.53;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of i...@bnoordhuis.nl designates 209.85.220.53 as permitted sender) smtp.mail=i...@bnoordhuis.nl
Received: by mail-pa0-f53.google.com with SMTP id bj3so534355pad.26
        for <nodejs@googlegroups.com>; Tue, 30 Oct 2012 16:05:24 -0700 (PDT)
        d=google.com; s=20120113;
        h=mime-version:x-originating-ip:in-reply-to:references:date
         :message-id:subject:from:to:content-type:x-gm-message-state;
        bh=3ndCu9PVczYiEyvAyHqRrMvPn4sev8Uc3U2zL3zfo+k=;
        b=gtyuL/r42SqaEaUPxK8p7/SoPjos7eaGlyzJ/Q6GHH+oqlKB95tMxCMdU8JsltWD3a
         /DcgGSuFsze2nD/VnAzcvCzUqfMgFi+k5i0o0x/cR40hpQ6Il1ie88zMXxhRGqzfwQSc
         QkUih7XX1lEIoJ+xC/xZ2+KgnJvFvk+Mk/WeWjn16x5yppGyJpVeJMk/6iaCk7m++oyl
         R5HNLQpvC8VfKKnNTqpVnYjdiV35pf3X+9CNlVOoqaESPwO+hTQH/lYLwy+Of8+2KAj/
         W9tr12R1TLtV0q40seYx8pI+FN9b4/O6yuyNbs12EpmU5DzxHBp1FQiISS7sVcwOjuYl
         WKdA==
MIME-Version: 1.0
Received: by 10.68.252.133 with SMTP id zs5mr106525569pbc.152.1351638324339;
 Tue, 30 Oct 2012 16:05:24 -0700 (PDT)
Received: by 10.68.51.42 with HTTP; Tue, 30 Oct 2012 16:05:24 -0700 (PDT)
X-Originating-IP: [87.214.96.125]
In-Reply-To: <09b0649c-0bfc-4baf-8008-e780c0ba7909@googlegroups.com>
References: <09b0649c-0bfc-4baf-8008-e780c0ba7909@googlegroups.com>
Date: Wed, 31 Oct 2012 00:05:24 +0100
Message-ID: <CAHQurc9vfap54Y-4SkyNRH97ZEDx_dn=ue8DeO76=coibRk...@mail.gmail.com>
Subject: Re: [nodejs] https problem one server, two url, two ip addresses
 (eth0 and eth0:0)
From: Ben Noordhuis <i...@bnoordhuis.nl>
To: nodejs@googlegroups.com
Content-Type: text/plain; charset=ISO-8859-1
X-Gm-Message-State: ALoCoQkq6Wf/CmRyoETwRW0q5SzHhfboflA+qKQqpu/65a1PYpFx1h0fUmn34rkXTbg16F3ivMgS

On Tue, Oct 30, 2012 at 7:16 PM, Karl <klru...@gmail.com> wrote:
> Hi,
> (Debian 6, Node 8.10, express 3, zappa 4.10)
> I have requested a second ip number for my remote box
> and want two run a second nodejs app on that ip. The ip
> runs on the same card I guess (remote box)
>
> So I have
> web1.net on ip1
> web2.com on ip2
>
> and use iptables to redirect from 80 and 443 to
> my ports
> PROD# iptables -L -t nat
> Chain PREROUTING (policy ACCEPT)
> target     prot opt source               destination
> REDIRECT   tcp  --  anywhere             www.web1.net tcp dpt:www redir
> ports 3003
> REDIRECT   tcp  --  anywhere             www.web2.com   tcp dpt:www redir
> ports 3004
> REDIRECT   tcp  --  anywhere             www.web1.net tcp dpt:https redir
> ports 3443
> REDIRECT   tcp  --  anywhere             www.web2.com   tcp dpt:https redir
> ports 3445
>
> and ensure-https to protocol change all 80 traffic to 443:
>
> var ensure=require('ensure-https');
> var options={
>   'forceHost':undefined,   // If this is set then the destination URL is
> forced to this hostname
>   'host':'localhost',      // This is the default host to use (for HTTP/0.9
> clients) (default: localhost)
>   'sslHost':443,           // This is the port of your HTTPS server if it is
> not 443 (default: 443)
>   'statusCode':301         // This is the HTTP Status-Code to use
> (default: 301)
> };
> var server=ensure.createServer(options);
> server.listen(3004,'ip1...');
>
> and the same for the other one, ip2 (web2.com).
>
> My *problem*: web1.net works fine when users enter
> www.web1.net or https://web1.net or even https://web1.net:3443
> but web2.com will only work if I give the https://web2.net:3445 format
> otherwise I get "unable to connect"
>
> They have two separate certificates, they works with all browsers I tried.
>
> /etc/hostname has "www.bodywrappers.net"
>
> /etc/hosts has
> 127.0.0.1 localhost.localdomain localhost
> ip1... www.web1.net web1.net
> ip1.. sxxxxxxx.online.de  (this is a rented box)
> ip2... www.web2.com web2.com
> The A records are redirected <-> from a different provider but that works
> with web1.net
>
> /etc/networks/interfaces
> auto lo eth0
> iface lo inet loopback
>
> iface eth0 inet dhcp
>
> auto eth0:0
> iface eth0:0 inet static
>         address   ip2...
>         netmask   255.255.255.0
>         network   ip2....0
>         broadcast ip2....255
>
> Thanks, I'm a bit lost. Feel free to comment more compact solutions, too, of
> course. Still a bit green here.

What does `/sbin/ipconfig` print?  If you have only one interface with
one address, you can - realistically speaking - forget about
multi-domain SSL.