虚拟主机apache2 / httpd中具有重写器的代理,类似于nginx代理

问题描述

您好,我在apache2 / httpd配置文件中配置代理时遇到问题。我必须创建类似于此nginx配置的内容:

location /test {
        proxy_pass      http://127.0.0.1:8080;
        rewrite ^/test/?(.*)$   /someapi/abc/$1 break;
        proxy_set_header    Host $host;
        proxy_set_header        X-Real-IP $remote_addr;
                proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    }

例如,当我发送邮件时:在前端应用程序中将请求发布到:http:// localhost:9000 / test / command?arg1 = 1我希望它重定向到http://127.0.0.1:8080/someapi/abc/command?arg1=1并将响应发送回前置应用程序。我试图使用ProxyPass,ProxyPassReverse,标签和RewriteRule,但没有任何结果>。

<Location "/test">
   ProxyPass "/test/" "http://127.0.0.1:8080/someapi/abc/"
   ProxyPassReverse "/test/" "http://127.0.0.1:8080/someapi/abc/"
</Location>

您能帮我这个配置吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)