I am creating a RESTful API in PHP, and have encountered a problem. When the client is posting data to the server, the server should return:
Status code 201
The solution was to create an IIS module, that rewrites the header "Custom-Location" to "Location" after FastCGI is done.
Then, FastCGI won't know that we are sending a Location header at all, and it won't modify my response.
The module:
string Location = context.Response.Headers["Custom-Location"] as string;
if (!string.IsNullOrEmpty(Location))
{
context.Response.Headers.Remove("Custom-Location");
context.Response.AddHeader("Location", Location);
}
PHP:
header("Custom-Location: http://google.no",true,201);
header("Content-Type: application/xml");
echo " ";
(still dummy code, not extremly correct code :) )