: This article describes how to modify the NginxHTTP return status code. For more information about PHP tutorials, see. Because the traffic limit of limit_req is set in nginx configuration, many requests return error Code 503. to improve the user experience, the system wants to return normal Code 200 under the condition of throttling, frequently returned information:
Location/test {... limit_req z burst = 1 nodelay; error_page 503 = 200/dealwith_503? Callback = $ arg_callback;} location/dealwith_503 {set $ ret_body '{"code": "V00006", "msg": "operations are too frequent. please sit down and have a cup of tea. "} '; If ($ arg_callback! = "") {Return 200 'try {$ arg_callback ($ ret_body)} catch (e) {}';} return 200 $ ret_body ;}
The above describes how to modify the Nginx HTTP return status code, including some content. I hope my friends who are interested in the PHP Tutorial will be helpful.