W7 Pro IIS 7.5 overwrites PHP Location: Header

前端 未结 3 536
日久生厌
日久生厌 2021-01-05 18:30

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          


        
3条回答
  •  青春惊慌失措
    2021-01-05 18:58

    I had similar problem with WP REST API on IIS 8.5. Following html

    
        Document Moved
    
    
        

    Object Moved

    This document may be found here

    was added at start of every json returned with Location header and status 201 Created. Content-Type was changed to text/html; charset=UTF-8.

    Adding cgi.rfc2616_headers = 1 in php.ini resulted with:

    • clean body (json) without added html
    • correct "Content-Type"
    • "Location" header missing
    • Status chaged to 200 OK

    I wouldn't call this solution, this is more replacing one problem with another. Luckily this new problem in my situation was smaller than original one.

提交回复
热议问题