我有一个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;
}
}
我将如何配置此块以确保将请求传递到正确的路径?这看起来正确吗?