WordPress Sitehealth shows Rest API did not behave correctly

In the latest WordPress version 5.2, it includes a sitehealth tool in Dashboard > Tools. I got this error after upgrade WordPress.

The Rest API did not behave correctly

The REST API is one way WordPress, and other applications, communicate with the server. One example is the block editor screen, which relies on this to display, and save, your posts and pages.

The REST API did not process the context query parameter correctly.

To fix the issue for wordpress on Nginx, add a server block to your nginx config:

location ~ ^/wp-json/ {
   rewrite ^/wp-json/(.*?)$ /?rest_route=/$1 last;
}