Skip to content

Commit

Permalink
Merge pull request #73 from jsierles/ngrok-support
Browse files Browse the repository at this point in the history
support .ngrok.io domains for remote access
  • Loading branch information
typicode committed May 2, 2015
2 parents 4c06923 + 93aa74e commit a8d7421
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/daemon/http-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ function log(id, msg, err) {

// For http://www.app.ka will return ['www', 'app']
// For http://www.app.10.0.0.1.xip.io will return ['www', 'app']
// For http://www.app.ngrok.io will return ['www', 'app']
function removeTopLevelDomain(host) {
if (/.xip.io$/.test(host)) {
return host.split('.').slice(0, -6)
} else if (/.ngrok.io$/.test(host)) {
return host.split('.').slice(0, -2)
} else {
return host.split('.').slice(0, -1)
}
Expand Down Expand Up @@ -174,7 +177,7 @@ module.exports.createServer = function() {
}

// Verify host is set and valid
if (!(/.ka$/.test(host) || /.xip.io$/.test(host))) {
if (!(/.ka$/.test(host) || /.xip.io$/.test(host) || /.ngrok.io$/.test(host))) {
log(host, 'Not a valid Host')
res.statusCode = 200
return res.end(render('200.html', {
Expand Down

0 comments on commit a8d7421

Please sign in to comment.