Fastcgi trouble with status headers in application_controller.rb
David Raison <
david@...>
2012-01-31 21:14:53 GMT
Here's number two.
I had trouble getting the http-authentication to work with fastcgi since
it seems to be very picky when it comes to headers.
I had to comment line 36 in application_controller.rb in order to not
have it complain:
[Tue Jan 31 21:37:14 2012] [error] [client 178.254.102.***] FastCGI:
comm with server
"/var/www/haxogreen.lu/pentabarf/rails/public/dispatch.fcgi" aborted:
error parsing headers: duplicate header 'Status'
So in the end, my transaction_wrapper now looks like this:
def transaction_wrapper
response.content_type ||= Mime::HTML
Momomoto::Database.instance.transaction do
if auth
# if auth succeeds we continue
yield
elsif not performed? then
# if auth failed and nothing has been rendered we return 401
#response.headers["Status"] = "Unauthorized"
response.headers["WWW-Authenticate"] = "Basic realm=Pentabarf"
render(
:file=>'auth_failed.rxml',:status=>401,:content_type=>'text/html' )
end
POPE.deauth
(Continue reading)