How to deal with ports and subdomains?

27 views
Skip to first unread message

felipe....@gmail.com

unread,
May 7, 2014, 11:08:38 AM5/7/14
to action...@googlegroups.com
Hi,

I want to be able to forward subdomains

api.domainname.com >> domainname.com/api

and ports

domainname.com:8000 >> domainname.com

Any idea where I can find some info on this? I've seen some examples with modules on node but I'm not sure how to apply this to actionhero.

Regards


Hidden Knowledge

unread,
May 7, 2014, 1:52:56 PM5/7/14
to action...@googlegroups.com, felipe....@gmail.com
To change your port, go to config/servers/web.js and find the port option.
Be advised though, that only one application can use a port at once, so if you're running a webserver like apache, you can't run node on that port as well.

Evan Tahler

unread,
May 7, 2014, 2:15:26 PM5/7/14
to Hidden Knowledge, action...@googlegroups.com, felipe....@gmail.com
And for forwarding sub-domains, you need an application running & listening on that subdomain to tell the browser to go somewhere else.  You should either do this with a 300-series header.  an actionhero server running on a server responding to your subdomain can set headers to move users along, but you can also do this with a really simple node app:

var http = require('http');

var server = http.createServer(function(req, res) {
  res.writeHead(301, {'Location': 'http://www.google.com'});
  res.end();
});

server.listen(8080);

--
You received this message because you are subscribed to the Google Groups "actionHero.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to actionhero-j...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages