Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
I think it would be funny if my web application that is hosted using an nginx reverse proxy (proxy_pass) returned something like 200 Could Be Worse rather than 200 OK, when the page load was succes...
#1: Initial revision
Setting custom HTTP status code messages in nginx
I think it would be funny if my web application that is hosted using an nginx reverse proxy (proxy_pass) returned something like `200 Could Be Worse` rather than `200 OK`, when the page load was successful. I know that there is a `return 200 "message";` command, but when I just add that to my site config file, the rest of the response is not returned but just the message portion. I tried adding a `\n` at the end, as I read somewhere, but it didn't change anything. Also, a possible issue with this approach is that, as far as I can tell, it would *always* return "200 Could Be Worse", even if it should respond with something like 404 or 500. I thought about adding an `error_page` rule, but if I add that for a 200 status code, nginx config validation fails with the following error message: ``` nginx: [emerg] value "200" must be between 300 and 599 in /etc/nginx/sites-enabled/[site-name]:8 nginx: configuration file /etc/nginx/nginx.conf test failed ``` So, how *do* I make my http status messages more fun in nginx?