问题原文
原帖链接 · munHunger · CC BY-SA 4.0
So I have a configuration for apache that is working in 99% of the cases.
It is checking a header value in the request and based on that it is redirecting to the correct API version url with a 307 status.
This works for all clients that properly implement the http stack. unfortunately I have an app that doesn't follow this and converts all POST requests into GET.
So this is the proxy.conf that I got right now:
RewriteEngine On
RewriteCond %{HTTP:X-Android-Version} =660
RewriteRule ^/services/6/(.*)$ /services/internal/6/$1 [R=307]
RewriteCond %{HTTP:X-Android-Version} >661
RewriteRule ^/services/6/(.*)$ /services/internal/7/$1 [R=307]
ProxyPass /services/internal/7 http://mbe700:8080/services/6
ProxyPass /services/internal/6 http://mbe600:8080/services/6
So what I am wondering is:
Is it possible to the same sort of proxypass without using a URL rewrite rule, since that doesn't really work in my case?
已采纳解答
原帖链接 · munHunger · CC BY-SA 4.0
Turns out this was way easier than I imagined... just changing the flag on the rewriterule seems to have done the trick.
RewriteEngine On
RewriteCond %{HTTP:X-Android-Version} =660
RewriteRule ^/services/6/(.*)$ /services/internal/6/$1 [P]
RewriteCond %{HTTP:X-Android-Version} >661
RewriteRule ^/services/6/(.*)$ /services/internal/7/$1 [P]
ProxyPass /services/internal/7 http://mbe700:8080/services/6
ProxyPass /services/internal/6 http://mbe600:8080/services/6
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
