我想在代理中添加URL中的参数。 例如,我想添加一个apiKey:&apiKey = tiger
http://mywebsite.com/oneapi?field=22 —> https://api.somewhere.com/?field=22&apiKey=tiger你知道一个解决scheme吗?
吉尔,非常感谢。
server { listen 80; server_name mywebsite.com; location /oneapi{ proxy_pass https://api.somewhere.com/; } }
Https Nginx NodeJS SocketIO和CORS请求失败
将子域redirect到端口
单声道MVC 2家庭路线不起作用
乘客,Nginx和Capistrano – 乘客没有启动Rails应用程序
Nginx – 如何在使用try_files时为index.html添加头文件
如何强制浏览器在代码部署后重新加载静态资产?
发送redirect到特定的端口
Nginx如何将proxy_pass传递给代理
location = /oneapi { set $args $args&apiKey=tiger; proxy_pass https://api.somewhere.com; }
set $token "?"; # init token is "?" for original request without args if ($is_args) { # if the request has args update token to "&" set $token "&"; } location /test { set $args "${args}${token}k1=v1&k2=v2"; # update original append custom params with $token # if no args $is_args is empty str,else it's "?" # http is scheme # service is upstream server proxy_pass http://service/$uri$is_args$args; # proxy pass } #http://localhost/test?foo=bar ==> http://service/test?foo=bar&k1=v1&k2=v2 #http://localhost/test/ ==> http://service/test?k1=v1&k2=v2
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。