Skip to content

Commit

Permalink
add canonical host middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
indirect committed Jan 11, 2022
1 parent f5e42db commit 6101ec8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ gem "jbuilder", "~> 2.11"
gem "nilify_blanks", "~> 1.4"
gem "pg", "~> 1.2"
gem "puma", "~> 5.5"
gem "rack-canonical-host", "~> 1.1", require: false
gem "redis", "~> 4.5"
gem "rspec-rails", "~> 5.0"
gem "sprockets-rails", "~> 3.4"
Expand Down
7 changes: 7 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ GEM
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
bindex (0.8.1)
bootsnap (1.9.4)
msgpack (~> 1.0)
Expand Down Expand Up @@ -144,10 +146,14 @@ GEM
nokogiri (1.13.0-x86_64-linux)
racc (~> 1.4)
pg (1.2.3)
public_suffix (4.0.6)
puma (5.5.2)
nio4r (~> 2.0)
racc (1.6.0)
rack (2.2.3)
rack-canonical-host (1.1.0)
addressable (> 0, < 3)
rack (>= 1.0.0, < 3)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (7.0.1)
Expand Down Expand Up @@ -247,6 +253,7 @@ DEPENDENCIES
nilify_blanks (~> 1.4)
pg (~> 1.2)
puma (~> 5.5)
rack-canonical-host (~> 1.1)
rails (~> 7.0)
redis (~> 4.5)
rspec-rails (~> 5.0)
Expand Down
3 changes: 2 additions & 1 deletion config.ru
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# This file is used by Rack-based servers to start the application.

require_relative "config/environment"
require "rack/canonical_host"

use Rack::CanonicalHost, ENV["HOST"] if ENV.key?("HOST")
run Rails.application
Rails.application.load_server

0 comments on commit 6101ec8

Please sign in to comment.