Sha256: 8ebe848a53e56e51e1bdaa4a576b8f864945ce8e14f8e9d1f6808d21c5ff2896

Contents?: true

Size: 397 Bytes

Versions: 5

Compression:

Stored size: 397 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

5 entries across 5 versions & 1 rubygems

Version Path
divining_rod-0.6.4 lib/divining_rod/utilities.rb
divining_rod-0.6.3 lib/divining_rod/utilities.rb
divining_rod-0.6.2 lib/divining_rod/utilities.rb
divining_rod-0.6.1 lib/divining_rod/utilities.rb
divining_rod-0.6.0 lib/divining_rod/utilities.rb