将 POST 请求重写到 NGINX 中的不同主机

Rewrite POST requests to different host in NGINX

我有一个带有 express 的 React 应用程序。我是运行 Nginx 作为反向代理。该应用程序 POST 请求 /api/rest/2/issue/ 的亲戚 url。如何重写 url 以使用不同的主机,例如 https://example.com/api/rest/2/issue/ 用于 POST 请求。

正常的 GET 请求必须转到标准端口 80。

我已经在我的虚拟主机上试过了:

location /rest/api/2/issue {
   proxy_pass https://example.com/rest/api/2/issue;

你只需要

location /rest/ {
   proxy_pass https://example.com/rest/;
}