./lib/rack/subdomain.rb in rack-subdomain-0.4.0 vs ./lib/rack/subdomain.rb in rack-subdomain-0.4.1
- old
+ new
@@ -59,10 +59,10 @@
@domain
end
end
def subdomain
- @env['HTTP_HOST'].sub(/\.?#{domain}.*$/,'') unless @env['HTTP_HOST'].match(/^localhost/) or IPAddress.valid?(@env['SERVER_NAME'])
+ @env['HTTP_HOST'].sub(/\.?#{domain}.*$/,'') unless @env['HTTP_HOST'].nil? || @env['HTTP_HOST'].match(/^localhost/) || IPAddress.valid?(@env['SERVER_NAME'])
end
def remap_with_substituted_path!(path)
scheme = @env["rack.url_scheme"]
host = "#{@subdomain}.#{domain}"