Last active
September 24, 2016 21:30
-
-
Save homakov/ea001418ecf15319a3e0 to your computer and use it in GitHub Desktop.
Revisions
-
homakov revised this gist
Jun 26, 2015 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,11 +4,12 @@ require ::File.expand_path('../config/environment', __FILE__) #prevents DNS rebinding attacks class DNSBinding VALID_HOSTS = %w{localhost:9292 myshop.dev:3000 myshopprod.com} def initialize(app) @app = app end def call(env) if VALID_HOSTS.include? env['HTTP_HOST'] @app.call(env) else [403,{},["Invalid Host"]] -
homakov revised this gist
Jun 26, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,7 @@ class DNSBinding @app = app end def call(env) if %w{localhost:9292 myshop.dev:3000 myshopprod.com}.include? env['HTTP_HOST'] @app.call(env) else [403,{},["Invalid Host"]] -
homakov revised this gist
Jun 26, 2015 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,6 @@ class DNSBinding @app = app end def call(env) if %w{localhost:9292}.include? env['HTTP_HOST'] @app.call(env) else -
homakov created this gist
Jun 26, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ # This file is used by Rack-based servers to start the application. require ::File.expand_path('../config/environment', __FILE__) #prevents DNS rebinding attacks class DNSBinding def initialize(app) @app = app end def call(env) puts env['HTTP_HOST'] if %w{localhost:9292}.include? env['HTTP_HOST'] @app.call(env) else [403,{},["Invalid Host"]] end end end use DNSBinding run Rails.application