Sha256: bc85ba9e63fc186870f081e9b303facb6a15c384405c8cbc8a764da1a8efe7a2

Contents?: true

Size: 404 Bytes

Versions: 1

Compression:

Stored size: 404 Bytes

Contents

module DiviningRod
  class Utilities
    
    def self.parse_subdomain(request)
      env = request.env
      if forwarded = env["HTTP_X_FORWARDED_HOST"]
        host = forwarded.split(/,\s?/).last
      else
        host = env['HTTP_HOST'] || env['SERVER_NAME'] || env['SERVER_ADDR']
      end
      if host
        host.sub(/\:\d+/, '').split('.')
      else
        []
      end
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
divining_rod-0.5.0 lib/divining_rod/utilities.rb