Asset_host and ssl pages problem

I am configuring assets hosts for our site but am running into problems
when navigating to an https page. Basically the server is trying to pull
the assests out on https:// rather than http:/ but i do not have https
configured on the assets server. I have dug around a bit and found this
bit of code which should when a page is https:// serve the assests from
the app server and when it is not https serve the assets from the assets
server.

ActionController::Base.asset_host = Proc.new { |source, request|
if request.ssl?
“#{request.protocol}#{request.host_with_port}” # Disable asset
hosting.
else
“#{request.protocol}assets1.example.com” # Use asset host.
end
}

but i always get this error when navigating to any page

Showing layouts/admin.html.erb where line #8 raised:
You have a nil object when you didn’t expect it!
The error occurred while evaluating nil.ssl?

Extracted source (around line #8):
5:
6:
7:
8: <%= stylesheet_link_tag ‘shared’, ‘legacy_admin’, ‘admin’, :media =>
“all” %>
9: <%= javascript_include_tag :defaults %>
10: <%= javascript_include_tag ‘clocks.js’ %>
11:

i have also tried this
config.action_controller.asset_host = Proc.new do |source, request|
request.ssl? || source = /javascripts/ ?
“#{request.protocol}#{request.host_with_port}” :
http://assets1.example.com
end

but i get the same problem.

Any body else seen this problem? I am using rails 2.0.2 with mod_rails
1.0.5 and apache 2.2.6

turns out i needed rails 2.1.0 and actionpack 2.1.0 as there was a patch
needed to asset_tag_helper.rb that i did not have.