Ruby on Rails Tuesday, January 4, 2011

I have to change all headers in Ruby on rails response message. This
must be done because my application should read another www-page from
the other server and then send it to the client such as it comes from
the original web server.

I thought first that it is easy to change headers in class
ApplicationController < ActionController::Base by creating after
filter following way:

class ApplicationController < ActionController::Base
after_filter :customheaders

private

def customheaders
response.headers["Test header title"]="Test header value"
end
end

However, my application sends always just default headers. I know that
the after filter works because if I change body content in
customheaders -function, it works (response.body = "New body
content").

The application renders web page normally in a view-component. Rails
version is 3.0.3.

Would anyone know how I could change all headers of the response
message in application controller?

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment