# Changing HTTP status from FastCGI

**URL:** <https://www.ruby-forum.com/t/changing-http-status-from-fastcgi/195061>\
**Category:** NGINX\
**Created:** [September 16, 2010, 2:24am UTC](https://www.ruby-forum.com/t/changing-http-status-from-fastcgi/195061 "2010-09-16T02:24:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tdebber](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/bbce88/32.png) [@tdebber](https://www.ruby-forum.com/u/tdebber)\
**Post date:** [September 16, 2010, 2:24am UTC](https://www.ruby-forum.com/t/changing-http-status-from-fastcgi/195061/1 "2010-09-16T02:24:00Z")

</div>

Hello,

I am trying to change the HTTP status that is sent when I send a  
response to a FastCGI query. In the nginx configuration file, I have

fastcgi\_pass\_header Status;

When generating my return stream, which is done in C++, the first part  
of response is:  
“Status: 201\r\n”  
I have also tried:  
“Status: 201 Created\r\n”  
as well as different combinations of \n and \r\n following the header.  
In all cases, HTTP/1.1 200 OK is set as the Status and the body of the  
response contains the string I’ve tried to use as my header. Any hints  
as to what I may be doing wrong?

Thank you,  
Matt Debski

Posted at Nginx Forum:

> **[Changing HTTP status from FastCGI](https://forum.nginx.org/read.php?2,130798,130798#msg-130798)**
>
> Hello, I am trying to change the HTTP status that is sent when I send a response to a FastCGI query. In the nginx configuration file, I have fastcgi\_pass\_header Status; When generating my return stream, which is done in C++, the first part of...

---

<div class="post-metadata">

**Author:** ![tdebber](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/bbce88/32.png) [@tdebber](https://www.ruby-forum.com/u/tdebber)\
**Post date:** [September 16, 2010, 10:06pm UTC](https://www.ruby-forum.com/t/changing-http-status-from-fastcgi/195061/2 "2010-09-16T22:06:59Z")

</div>

On Wed, Sep 15, 2010 at 08:23:31PM -0400, tdebber wrote:

> Hello,
> 
> I am trying to change the HTTP status that is sent when I send a  
> response to a FastCGI query. In the nginx configuration file, I have
> 
> fastcgi\_pass\_header Status;

You should not pass Status header line.

> When generating my return stream, which is done in C++, the first part  
> of response is:  
> “Status: 201\r\n”  
> I have also tried:  
> “Status: 201 Created\r\n”  
> as well as different combinations of \n and \r\n following the header.  
> In all cases, HTTP/1.1 200 OK is set as the Status and the body of the  
> response contains the string I’ve tried to use as my header. Any hints  
> as to what I may be doing wrong?

## You should seperate response header and body using additional “\r\n”:

Status: 201  
Content-Type: text/html

## some body text

If you send only Status without other headers, you need to change:

- “Status: 201\r\n”

- "Status: 201\r\n\r\n"

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**
