0

Apache removes one line from header, and i don't know why. Here is PHP code

header("status: 200");
header("test: 200");

When I check response with Fiddler, second line in header line with "status" is missing but "test" is present. This happens on new server only and i don't know what to check. Both servers are hosted, so i do not have luxury to inspect them.

I tried looking for .htaccess and mod_header settings but could not find anything.

Edit #1: i have header("HTTP/1.1 200 OK"); before lines above. So response code is good, but client needs to see this "status: 200" in response because legacy application expects it.

Edit #2: the question is why does one server leaves "status: 200" and the other one does not.

Please help.

Filip Popović
  • 2,637
  • 3
  • 18
  • 18
  • I think you're setting the status incorrectly ... look at https://stackoverflow.com/questions/3258634/php-how-to-send-http-response-code for more deets – treyBake Dec 18 '18 at 10:20
  • @treyBake thanks, i realize that, the thing is that code is working on one server and not on the other, and php and apache versions are the same on both servers. and i need to make it work on both asap – Filip Popović Dec 18 '18 at 10:48

1 Answers1

0

You can set the status header with the following line:

header("HTTP/1.1 200 OK");

That is the common way to set a http status in PHP. 200 is the normal status code for "OK". So if you don't produce an error your Webserver will already return 200. So you should check Header that exists.

Here is a list of header stat are used in http.

https://www.whitehatsec.com/blog/list-of-http-response-headers/

René Höhle
  • 26,716
  • 22
  • 73
  • 82
  • Yes, that is the way to do it, but original question is "why does one server removes added status line and the other does not?" – Filip Popović Dec 22 '18 at 11:24