Skip to content

Commit

Permalink
Add multiple domain support for rack
Browse files Browse the repository at this point in the history
  • Loading branch information
shuber committed Jun 5, 2009
1 parent 7e8baf2 commit bfe769c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG
@@ -1,3 +1,6 @@
2009-06-05 - Sean Huber (shuber@huberry.com)
* Add multiple domain support for rack

2009-06-04 - Sean Huber (shuber@huberry.com)
* Update test related rake tasks
* Remove huberry namespace
Expand Down
6 changes: 5 additions & 1 deletion lib/proxy.rb
Expand Up @@ -15,7 +15,11 @@ def self.replace_host_with(&block)
private

def self.before_dispatch(dispatcher)
request = dispatcher.instance_variable_get('@request')
request = dispatcher.instance_variable_get('@request') || dispatcher.instance_variable_get('@env')
if request.is_a?(Hash)
request.each(&:inspect) # TODO: we can't access the 'rack.request' key without doing this first...wtf
request = request['rack.request']
end
new_host = replace_host_with_proc.call(request)
request.env['HTTP_X_FORWARDED_HOST'] = [request.host, new_host].join(', ') unless new_host.blank?
end
Expand Down

0 comments on commit bfe769c

Please sign in to comment.