使用proxy_pass的nginx位置

时间:2019-10-21 22:06:35

标签: http nginx reverse-proxy

我有一个nginx反向代理容器,该容器终止TLS并将请求路由到我的自定义API容器。 API URI的根路径是/api,其中包含多个子路径,即/api/register//api/authenticate//api/deviceId/getDevice/等。

这是我设置的当前位置信息块:

location /api/ {
  proxy_pass http://myapi:8080/;

  # Reject requests with unsupported HTTP method
  if ($request_method !~ ^(GET|POST)$) {
    return 405;
  }
}

我将如何配置此块以确保将请求传递到正确的路径?这看起来正确吗?

0 个答案:

没有答案