简体   繁体   English

Node.js + express 如何在请求中添加字符串 url?

[英]Node.js + express how to add string to the request url?

I have a reverse proxy that works great like this:我有一个像这样工作的反向代理:

app.all('/geoserver', function (req, res) {
    apiProxy.web(req, res, {target: serverOne});
});

I need to add to the request url a string like this:我需要在请求 url 中添加这样的字符串:

&cql_filer=strSubstring(codigo,0,3)=%27201%27 &cql_filer=strSubstring(codigo,0,3)=%27201%27

Before proxying to the serverOne .在代理到serverOne之前。

Tried with req = req + '&cql_filer=strSubstring(codigo,0,3)=%27201%27';尝试使用req = req + '&cql_filer=strSubstring(codigo,0,3)=%27201%27'; but it is not working.但它不工作。

Any idea on how to solve this?关于如何解决这个问题的任何想法? Thanks!谢谢!

The proxy module seems to use req.url to determine the url to proxy to.代理模块似乎使用req.url来确定要代理到的 url。 You can change req.url to your needs.您可以根据需要更改req.url

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM