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: <head>
6: <meta http-equiv="content-type"
content="text/html;charset=UTF-8" />
7: <title></title>
8: <%= stylesheet_link_tag ''shared'',
''legacy_admin'', ''admin'', :media =>
"all" %>
9: <%= javascript_include_tag :defaults %>
10: <%= javascript_include_tag ''clocks.js'' %>
11: </head>
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
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---