Skip to content

Commit

Permalink
Merge pull request #129 from makenosound/master
Browse files Browse the repository at this point in the history
Add config option for `tileHost`
  • Loading branch information
Dane Springmeyer committed Jun 6, 2014
2 parents a8e4a21 + fdd48f6 commit 90c2dc2
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
26 changes: 25 additions & 1 deletion README.md
Expand Up @@ -132,10 +132,34 @@ as localhost, specify that hostname when you run TileStream:
tilestream --host 127.0.0.1
tilestream --host yourhost.com


In these examples, you would only be able to access tilestream from `127.0.0.1`
or `yourhost.com`, respectively, due to security restrictions.

You can also specify the hostname TileStream should use for URLs in its
responses by setting a custom `tileHost` value:

tilestream --tileHost yourhost.com
./index.js start --tileHost="yourhost.com"

This is useful if you want to sit your TileStream server behind a proxy (such as
nginx) and restrict direct access to TileStream:

tilestream --tileHost yourhost.com --host 127.0.0.1
./index.js start --tileHost="yourhost.com" --host="127.0.0.1"

These configuration flags can also be set using a JSON file:

./index.js start --config config.json

Where `config.json` is something like:

{
"host": ["127.0.0.1"],
"tileHost": "yourhost.com",
"tilePort": 8888,
"uiPort": 8888
}


Usage
-----
Expand Down
6 changes: 6 additions & 0 deletions commands/global.bones
Expand Up @@ -12,6 +12,12 @@ Bones.Command.options['tilePort'] = {
'default': 8888
};

Bones.Command.options['tileHost'] = {
'title': 'tileHost=[host]',
'description': 'Tile hostname',
'default': 'req.headers.host'
};

Bones.Command.options['subdomains'] = {
'title': 'subdomains=[list]',
'description': 'Comma separated list of subdomains to use for tiles.'
Expand Down
2 changes: 1 addition & 1 deletion servers/Host.bones
Expand Up @@ -31,7 +31,7 @@ server.prototype.hostInfo = function(req, res, next) {

if (req.headers && req.headers.host && !req.query.uiHost) {
req.query.uiHost = req.headers.host;
req.query.tileHost = [req.headers.host];
req.query.tileHost = this.config.tileHost || [req.headers.host];
if (subdomains) {
// Add subdomains for tiles.
var basehost = this.removeTileSubdomain(req.headers.host);
Expand Down

0 comments on commit 90c2dc2

Please sign in to comment.