我有一个apache服务器,它用3个不同的头获取http请求。根据报头,我必须将其发送到后端服务器。
网址: abc.com/check
标头:
“内容类型: app1”
“内容类型: app2”
“内容类型: app3”
根据上面的头部,请求必须发送到后端应用服务器。
如果“内容类型: app1”,则为server1:http://server1/s1
如果“内容类型: app2”,则为server2:http://server1/s2
如果“内容类型: app3”,则为server3:http://server1/s3
请帮帮我。
谢谢。
发布于 2020-03-18 02:55:05
我发现.Below代码片段可以满足我们的需求。我正在考虑的一些增强是只允许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>https://stackoverflow.com/questions/60713031
复制相似问题