Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Isn't this something that the http server handles? I am not in web development except for basic php and cgi scripts. Are people actually writing web app code to dictate what http code comes back on each request?


Yes, sometimes the correct response is not an HTML page, but an error code (e.g. 301 Moved Permanently, 302 Found are used to implement redirects).


And sometimes the correct response is an error code and an HTML page, e.g., 401 Unauthorized and an ajax login page that reloads the current URL.


A correct response code is the minimum to play nice, and a body, HTML or otherwise, is courteous. They are not mutually exclusive.

http://php.net/manual/en/function.header.php http://docstore.mik.ua/orelly/linux/cgi/ch03_03.htm#ch03-9-f...


You see more explicit use of http status codes in web service (data) API's particularly ones using REST.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: