nginx returns Chinese json

The project uses nginx as a proxy. If we encounter a project upgrade, we need to inform the mobile client that the current service is unavailable, and we don't want to create a special project to do this.

Here you can use the nginx configuration to solve this.

location ^~/api/{
    default_type application/json;return200'{"ret":"-1","msg":"request later plz"}';}

When the requested path starts with /api, it will be handled by this.

There may be garbled characters in Chinese in the returned json, and charset and charset_types need to be added.


location
^~/api/{ charset utf-8; charset_types application/json; default_type application/json;return200'{"ret":"-1","msg":"系统升级,请稍后访问"}';}

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327036798&siteId=291194637