我想通过代理传递在URL中添加参数。
例如,我要添加一个apiKey:&apiKey = tiger
http://mywebsite.com/oneapi?field=22 ---> https://api.somewhere.com/?field=22&apiKey=tiger
您知道解决方案吗?
非常感谢,
吉尔斯。
server {
listen 80;
server_name mywebsite.com;
location /oneapi{
proxy_pass https://api.somewhere.com/;
}
}
最佳答案
location = /oneapi {
set $args $args&apiKey=tiger;
proxy_pass https://api.somewhere.com;
}
关于nginx - Nginx proxy_pass:是否可以在URL中添加静态参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16532293/