This was almost too easy :) Again - not sure if I'm doing this the
right way but all I did was add Rack::ResponseHeaders before the
Rack::Rewrite call like so:

config.middleware.insert_before(Rack::Rewrite, Rack::ResponseHeaders)
do |headers|
      headers['Cache-Control'] = 'max-age=3600'
end

On Mar 12, 1:20 am, craayzie <flesh...@gmail.com> wrote:
> I've got Radiant deployed on Heroku and wanted to have it serve a
> static site in addition to my Radiant site. I used rack-rewrite to map
> requests for the static site to the right location but I'm not sure
> how to add the proper Cache-Control response header. Could you please
> point me in the right direction? Frankly, I'm not sure if rack-rewrite
> is the best solution here - it was just the first one I tried which
> appears to be working (aside from not sending any down-stream caching
> headers).
>
> config/environment.rb:
> Radiant::Initializer.run do |config|
> ...
> config.middleware.insert_before(Rack::Lock, Rack::Rewrite) do
>   send_file %r{.*}, 'public/static_site$&', :if => Proc.new { |
> rack_env|
>           rack_env['HTTP_HOST'] =~ /www.static-site.com($|:3000)/
>     }
> end
> ...
>
> Thanks!

Reply via email to