相关疑难解决方法(0)

NGINX 从 proxy_pass 响应中读取正文

我有两台服务器:

  1. NGINX(它将文件 id 交换为文件路径)
  2. Golang(它接受文件 id 并返回它的路径)

例如:当浏览器客户端向 发出请求时https://example.com/file?id=123,NGINX 应将此请求代理到 Golang 服务器https://go.example.com/getpath?file_id=123,后者会将响应返回给 NGINX:

{
  data: {
    filePath: "/static/..."
  },
  status: "ok"
}
Run Code Online (Sandbox Code Playgroud)

然后 NGINX 应该从 filePath 获取值并从该位置返回文件。

所以问题是如何在 NGINX 中读取响应(获取文件路径)?

lua nginx proxypass

8
推荐指数
1
解决办法
7369
查看次数

标签 统计

lua ×1

nginx ×1

proxypass ×1