This project is archived and is in readonly mode.
Custom response headers
-
Matt Fawcett
This works for me in a fresh rails 3.0.3 app:
Controller
class PeopleController < ApplicationController def index response.headers["Headertitle"]="Headercontent" render :text => Rails.version end endDemo
curl -i http://localhost:3001/people HTTP/1.1 200 OK X-Ua-Compatible: IE=Edge Etag: "895661fb4afa992a391c33b5534d0f9f" Connection: Keep-Alive Content-Type: text/html; charset=utf-8 Headertitle: Headercontent Date: Sat, 08 Jan 2011 17:18:23 GMT Server: WEBrick/1.3.1 (Ruby/1.8.7/2010-01-10) X-Runtime: 0.040454 Content-Length: 5 Cache-Control: max-age=0, private, must-revalidate 3.0.3% -
dspencer
I'm also using rails 3.0.3 and it worked fine for me as well.
Controller
class AppController < ApplicationController def example response.headers["Headertitle"]="Custom Header Content" render :text => "Hello, world." end endViewed in Chrome
Headertitle:Custom Header Content -
Xornor
Problem disappeared when I started Passenger in the Ruby on rails application directory and used application with it. I am not experienced to deploy Rails applications but I think that before the passenger, the application was executed by Mongrel.
So, there probably is not bug in Rails?
-
Neeraj Singh
- State changed from new to invalid
- Importance changed from to Low