Hi,

does anyone know if we can use variables with mod_substitute? I have some apps 
that respond to html on different ports in the same machine (that I don’t know 
in advanced), and I would like to access them through a proxy using an URL like 
http://myhost/app/1001. With this URL, I can connect to http://localhost:1001/. 

The problem is that I would like to prepend all addresses in the pages that 
those apps respond, with the port number of the app. I am trying to use 
mod_rewrite and mod_substitute. I can access each app in turn, but not managed 
to properly substitute the urls.

I wonder if I could used the env variable set by LocationMatch, or some other 
method to achieve similar result.
Here is my configuration:

       <LocationMatch “^/app/(?<uiport>\d+)">
                SetOutputFilter INFLATE;SUBSTITUTE;DEFLATE
                AddOutputFilterByType SUBSTITUTE text/html
                ReWriteRule app/(\d+)/(.*)  http://localhost:$1/$2 [P]
                Substitute s|href="/"|href=“/app/${env:MATCH_UIPORT}"|n
        </LocationMatch>

Best regards,
João

Reply via email to