Mysterious Content-Length: 0

I am lost here. I have a very simple action:

# DELETE /bookings/{id}
def destroy
  adapter = adapter_for(@booking.chain_id)
  adapter.cancel(@booking)
  if @booking.update_attribute(:cancelled, true)
    head :no_content
  else
    raise BookingGatewayError::SuccessfulButUnregistered
  end
end

that returns a 204 if successful. In all my trials and in hello world
applications I’ve done to debug this the Content-Length is 1 (you know
Rails unconditionally sends a space as a workaround for Safari):

HTTP/1.1 204 No Content
Connection: close
Date: Tue, 29 Jan 2008 18:05:16 GMT
Status: 204 No Content
X-Runtime: 0.00507
Cache-Control: no-cache
Server: Mongrel 1.1.3
Content-Type: text/html; charset=utf-8
Content-Length: 1

but same rails in vendor, same mongrel, same everything I can think of
gives a 0 in the production server:

HTTP/1.1 204 No Content
Date: Tue, 29 Jan 2008 18:20:07 GMT
Server: Mongrel 1.1.3
Status: 204 No Content
X-Runtime: 0.09667
Cache-Control: no-cache
Content-Type: text/html; charset=utf-8
Content-Length: 0

What could explain that 0?

– fxn

On Jan 29, 6:40 pm, Xavier N. [email protected] wrote:

There’s nothing like explaining something to find it out.

I’ve remembered in production mod_proxy is running and it isn’t in
development or in the rest of the trials. I could reproduce it that
way, looks like the Apache module is ignoring that somehow. Perhaps it
ignores the response body altogether because it is a 204? I’ll try to
continue figuring out what’s up with mod_proxy, but at least I have a
hint now.

This is relevant because it means if you are behind mod_proxy the
workaround is nullified.

– fxn

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs