The application is running on WebSphere in a distributed environment. I am trying to set up subdomain redirection for http://tt00.example.com:8080/xyz & http://tt00.example.com:8080/abc using a proxy. Users are accessing apps with different subdomain names like tt00, tt01, but with the same directory location /xyz and /abc.
http://tt00.example.com:8080/xyz
http://tt01.example.com:8080/xyz
http://tt02.example.com:8080/xyz
http://tt03.example.com:8080/xyz
http://tt00.example.com:8080/abc
http://tt01.example.com:8080/abc
http://tt02.example.com:8080/abc
http://tt03.example.com:8080/abc
I am trying to redirect based on subdomain name and same location /xyz or /abc. Redirection rules I defined work fine for applications running on the single environment but when it gets the same context root for multiple servers/environments it selects random env (tt00, tt01, tt03) for each page refresh.
<location /xyz>
Host required tt00.example.com:8080
ProxyPass http://10.198.40.72:9082/xyz
ProxyPassReverse http://10.198.40.72:9082/xyz
</location>
<location /abc>
Host required tt00.example.com:8080
ProxyPass http://10.195.40.72:9088/abc
ProxyPassReverse http://10.195.40.72:9088/abc
</location>
I have tried various options but did not succeed. Workaround worked using IF directive as below, but I cannot use proxy inside it.
<if "%{HTTP_HOST} == 'tt00.example.com:8080'">
Redirect "/xyz" to "http://10.198.40.72:9082/xyz"
Redirect "/abc" to "http://10.195.40.72:9088/abc"
</if>
I've tried this exact method before, but for some reason, it won't work. I'm not sure why?? Any other ideas out there?