2

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
  • 363
  • 1
  • 3
  • 9

1 Answers1

2

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
munHunger
  • 363
  • 1
  • 3
  • 9