I've a situation where I want to redirect everything that starts with /app to an internal server. Basically the idea is that Apache will work as a reverse proxy doing the following conversion:
http://external/app -> http://myserver:1082/myapp
I was able to do it using Rewrite, as follows:
RewriteCond %{REQUEST_URI} ^/app
RewriteRule ^/app(.*)$ http://myserver:1082/myapp$1 [L,P]
ProxyPassReverse /app http://myserver:1082/myapp
It works fine. The issue is that now I'm gonna have a language preffix on the URL, but no on the application. So I need the following redirection:
http://external/app -> http://myserver:1082/myapp
http://external/en/app -> http://myserver:1082/myapp
http://external/pt/app -> http://myserver:1082/myapp
While this can be done with the rewrite, I have a problem with the proxyPassReverse. Because basically I need to do a dynamic ProxyPassRever that, depending on the actual URL request by the user, changes the Location
ProxyPassReverse /en/app http://myserver:1082/myapp
ProxyPassReverse /pt/app http://myserver:1082/myapp
ProxyPassReverse /app http://myserver:1082/myapp
It would be something like
ProxyPassReverse ${preffix}/app http://myserver:1082/myapp
Is it possible to do that?
Best Answer
From ProxyPathReverse:
From Location:
So you should be able to use: