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.
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en