Apache>代理>如何转发包含POST数据的HTTP请求

ix0qys7i  于 2022-11-16  发布在  Apache
关注(0)|答案(1)|浏览(325)

我计划使用Apache代理模块(即mod_proxy)将传入的HTTP POST请求从跳转机转发到LAN内的另一台服务器。
我成功地转发了纯HTTP请求,但是对于POST数据,我不知道为什么它不起作用。
我在/etc/httpd/conf/httpd.conf中的设置如下所示:

ProxyRequests On
 ProxyVia On
 <Proxy *>
 Order deny,allow
 Allow from all
 </Proxy>
 ProxyPass /oozie/start_wf http://168.17.1.204:11000/oozie/v1/jobs?action=start
 ProxyPassReverse /oozie/start_wf http://168.17.1.204:11000/oozie/v1/jobs?action=start

我还需要在这部分配置中添加什么吗?

axkjgtzd

axkjgtzd1#

httpd.conf文件上的以下条目应该可以工作。

Listen 80

<VirtualHost *:80>
  ProxyPreserveHost On
  ServerName mycompany.com
  ServerAlias mycompany.com  
  ProxyPass /appServer http://<application_server_ip>:<port>
  ProxyPassReverse /appServer http://<application_server_ip>:<port>
  Redirect "/login" "/appServer/<application_context_root>/login"
  Redirect "/logout" "/appServer/<application_context_root>/logout"
  <Directory "/var/www/html">
    order allow,deny
    allow from all
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(.*) /index.html [NC,L]
  </Directory>
</VirtualHost>

相关问题