[英]http request forwarding according to the http header in apache
我有一个 apache 服务器,它获取带有 3 个不同标头的 http 请求。 根据标头,我必须将其发送到后端服务器。
网址:abc.com/check
标题:
“内容类型:app1”
“内容类型:app2”
“内容类型:app3”
根据上述标头,必须将请求发送到后端应用服务器。
server1 : http://server1/s1如果“内容类型:app1”
server2 : http://server1/s2如果“内容类型:app2”
server3 : http://server1/s3如果“内容类型:app3”
请帮帮我。
谢谢。
我想通了。下面的代码片段符合我们的要求。 我认为的一些改进是只允许 POST 请求。
<VirtualHost abc.com:80>
ServerName abc.com
RewriteEngine On
RewriteCond %{HTTP:Content-Type} "app1"
RewriteRule ^/check http://server1/s1 [P,L]
RewriteCond %{HTTP:Content-Type} "app2"
RewriteRule ^/check http://server1/s2 [P,L]
RewriteCond %{HTTP:Content-Type} "app3"
RewriteRule ^/check http://server1/s3 [P,L]
</VirtualHost>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.