首页 > 解决方案 > 无法转发用户提交的查询参数

问题描述

我想转发在浏览器中输入的请求,例如:

example.com/?wid=23&lang=en

到在不同端口上运行的服务器,例如:

http://localhost:3001/?wid=23&lang=en

我怎么能这样做?

我在 apache 中添加了一个 VirtualHost,如下所示:

    <VirtualHost *:80>

        #ServerName www.example.com

        ServerAdmin webmaster@example.com
        ServerName example.com
        ServerAlias example.com
        ProxyPass / http://localhost:3001/
        ProxyPassReverse / http://localhost:3001/


        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

但我不知道如何将查询参数传递给在不同端口上运行的 Nodejs 应用程序。

标签: pythonnode.jsapachehttpwebserver

解决方案


推荐阅读