Prevent IIS from changing response when Location h

2019-07-07 07:10发布

I have a RESTful web service written in a PHP-based framework running on IIS which responds to a POST request with something like

Status: 201 Created
Location: [url of created object]
Content-length: [correct]

{ my: "created object" }

It seems because of the Location header IIS is adding text to the response so it becomes (HTML removed for clarity):

Status: 201 Created
Location: [url of created object]
Content-length: [incorrect!]

Document Moved
Object Moved This document may be found here
{ my: "created object" }

I don't mind the addition of the text so much, but IIS seems to be keeping the original content-length while changing the content, creating an invalid response and thus causing the consumer of the web service to give me a protocol violation error.

Is there a way to prevent IIS from mangling my response?

Edit: Never did find an answer - I ended up switching to Apache

标签: php iis rest iis-7
0条回答
登录 后发表回答