lib/rack/subdomain.rb in rack-subdomain-0.0.1 vs lib/rack/subdomain.rb in rack-subdomain-0.0.2
- old
+ new
@@ -29,11 +29,16 @@
end
def map_to(subdomain)
if @map_to
@map_to.gsub!(":subdomain", subdomain)
- path_info = @env["PATH_INFO"]
- @env["PATH_INFO"] = "#{@map_to}#{path_info}"
+ new_path_info = "#{@map_to}#{@env["PATH_INFO"]}"
+ @env["PATH_INFO"] = new_path_info
+ new_request_uri = new_path_info.dup
+ if @env["QUERY_STRING"]
+ new_request_uri << "?" << @env["QUERY_STRING"]
+ end
+ @env["REQUEST_URI"] = new_request_uri
end
end
end
end