Skip to content

Commit 635e831

Browse files
committed
canonical hostname
1 parent d1d14f4 commit 635e831

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

Gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,4 @@ gem 'httparty'
6767
gem 'whenever'
6868
gem 'rqrcode-rails3'
6969
gem 'exception_notification'
70+
gem 'rack-canonical-host'

Gemfile.lock

+4
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ GEM
149149
pg (0.17.1)
150150
polyglot (0.3.3)
151151
rack (1.5.2)
152+
rack-canonical-host (0.0.8)
153+
addressable
154+
rack (~> 1.0)
152155
rack-test (0.6.2)
153156
rack (>= 1.0)
154157
rails (4.0.2)
@@ -244,6 +247,7 @@ DEPENDENCIES
244247
omniauth
245248
omniauth-github
246249
pg
250+
rack-canonical-host
247251
rails (= 4.0.2)
248252
rqrcode-rails3
249253
sass-rails (~> 4.0.0)

config.ru

+5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# This file is used by Rack-based servers to start the application.
22

33
require ::File.expand_path('../config/environment', __FILE__)
4+
5+
if host = CONFIG["canonical_host"]
6+
use Rack::CanonicalHost, host
7+
end
8+
49
run Rails.application

config/config.yml.sample

+1
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@ address_versions: # 55/117 for peercoin, 111/196 for testnet, see base58.h
4242
- 111
4343
- 196
4444

45+
canonical_host: peer4commit.example.com # will redirect all other hostnames to this one

0 commit comments

Comments
 (0)