【发布时间】:2021-07-05 11:20:54
【问题描述】:
我正在使用 GET api,其中有一个动态参数(变量)。我想获取该变量并将其提供给我的 Django 服务器,但是我如何在 Nginx 中解决这个问题,因为我有一个静态 api 位置。
我点击 api 的代码: 这里 waterQuantity 是由用户提供的变量。
http.Response response =await http.get('http://192.168.0.110/openValveConst/$waterQuantity');
这是我现在的 Nginx 配置文件:
location /openValveConst/ {
# why should i add / at the end 5000/ to make it work
proxy_pass http://127.0.0.1:8000/openValveConst/?format=json
proxy_set_header X-Forwarded-For $remote_addr;
}
请提出我应该做的更改以完成这项工作。
【问题讨论】: