Sunday, April 5, 2020

How to return static content from nginx

     

Some times you might need to return static response from nginx. for example validating file upload limit


  error_page 413 @413_xml;
  location @413_xml {
            default_type "text/xml; charset=UTF-8";
            return 413 '<?xml version="1.0" encoding="UTF-8"?><result><status><interfaceId>cabinet.file.insert</interfaceId><systemStatus>NG</systemStatus><message>Image size Error(Capacity)</message><requestId>$request_id</requestId><requests/></status><cabinetFileInsertResult><resultCode>3008</resultCode></cabinetFileInsertResult></result>';
        }

No comments:

Post a Comment

5 Strategies for Getting More Work Done in Less Time

Summary.    You’ve got more to do than could possibly get done with your current work style. You’ve prioritized. You’ve planned. You’ve dele...