Status response header overwriting HTTP response status-line

379 views
Skip to first unread message

Ralph Churchill

unread,
Jan 25, 2013, 12:47:27 PM1/25/13
to phusion-...@googlegroups.com
Hi, we're using passenger 3.0.19 and Apache 2.2.3. I've noticed that when passenger sets an HTTP response header of 'Status' that Apache is using that value to overwrite the status and reason in the status line. For example, Apache would normally return a status line of:

HTTP/1.1 200 OK
Date: Fri, 25 Jan 2013 17:43:26 GMT
Server: Apache
...


But, when passenger sets a response header of "Status: 200" then Apache's response status line looks like:

HTTP/1.1 200 
Date: Fri, 25 Jan 2013 17:12:58 GMT
Server: Apache
X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 3.0.19
...
Status: 200


I can manually set the status in Rails, e.g. headers['Status'] = "200 OK", and get the expected behavior (i.e. response status line of "HTTP/1.1 200 OK"). Is there a reason why passenger doesn't use the code AND the reason? Is there a way to "turn off" setting that header? Or is this something particular to my Apache setup (e.g. maybe mod_headers or something)?

Thanks!

Ralph

Hongli Lai

unread,
Jan 28, 2013, 7:03:07 AM1/28/13
to phusion-...@googlegroups.com
Phusion Passenger for Apache always sets the Status header because
there are broken HTTP clients out there that depend on the existance
of this header. In Phusion Passenger 3 the Status header insertion
code was written quickly so it just sets the status code but not the
reason phrase. In Phusion Passenger 4 the code has become more
sophisticated so it inserts the reason phrase as well.

Original thread:
https://groups.google.com/forum/?fromgroups=#!topic/phusion-passenger/A-A4FoT7rgk

Is there any reason why you want to remove the header?

--
Phusion | Ruby & Rails deployment, scaling and tuning solutions

Web: http://www.phusion.nl/
E-mail: in...@phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)

Ralph Churchill

unread,
Jan 28, 2013, 10:55:37 AM1/28/13
to phusion-...@googlegroups.com
Thanks for the explanation.

I don't want or need to remove the header, but I'm confused as to what -- in my particular case -- caused the reason phrase to "disappear". I can confirm that whatever goes into the status header winds up as the reason phrase. For example, if I manually set the header to "200 TEST", then the reason phrase is likewise, "200 TEST".

Is Apache doing this? Is passenger doing this?

For now, I have a workaround, but I'm curious as to what changed. All I did was update Apache from httpd-2.2.3-65.el5_8.3 to 2.2.3-76.el5_9. That minor update shouldn't have affected something like this.

Ralph

Hongli Lai

unread,
Jan 28, 2013, 1:10:13 PM1/28/13
to phusion-...@googlegroups.com

Phusion Passenger does that. The behavior is as follows:
- if there is no status header, one is automatically generated. The generated one has a code but no reason phrase.
- if there is a status header, it is passed through verbatim

Sent from my Android phone.

Op 28 jan. 2013 16:55 schreef "Ralph Churchill" <churc...@gmail.com> het volgende:
--
You received this message because you are subscribed to the Google Groups "Phusion Passenger Discussions" group.
To post to this group, send email to phusion-...@googlegroups.com.
To unsubscribe from this group, send email to phusion-passen...@googlegroups.com.
Visit this group at http://groups.google.com/group/phusion-passenger?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply all
Reply to author
Forward
0 new messages