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

时间:2017-10-09 10:36:36

标签: node.js rest express nginx reverse-proxy

我有一个带快递的React应用程序。我正在运行Nginx作为反向代理。该应用程序使POST请求的相对URL为/api/rest/2/issue/。如何重写URL以使用其他主机,例如https://example.com/api/rest/2/issue/用于POST请求。

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

我在我的vhost中试过这个:

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

1 个答案:

答案 0 :(得分:1)

你只需要

location /rest/ {
   proxy_pass https://example.com/rest/;
}
相关问题