0

I have a virtualhost that is a reverse proxy based on a path param "xmg"

<VirtualHost *:443>
ServerAlias some.example
SSL...
   ProxyPass /xmg http://localhost:5553/
   ProxyPassReverse /xmg http://localhost:5553/
<VirtualHost>

the application is not one i can change, the reverse proxy works, the base html loads, but the clientside html is not "aware" of the path param (xmg), so other assets (js,... ) are sought without the "/xmg/" how can i use the referer, in this case "https://some.example/xmg" to rewrite the requests "/bla.js" to localhost:5553/ or proxypass?

user22866
  • 151
  • 6
  • of how many files do we speak, what did you done, that the subdirectory is now required, and why is the application ot aware of this situation? i Mean this site is for business administrators, within business envoirment, where you have full control over the equipment, if its not the case then its not suitable for serverfault. please update your question by reading carefully [ask] – djdomi Feb 23 '24 at 15:26
  • 2
    A long time ago I wrote this answer for Apache 2.2 https://serverfault.com/a/561897/37681 - with the exception of the last bit I think that most of that is still valid and somebody posted a config that should work for Apache 2.4 as a separate answer – HBruijn Feb 23 '24 at 15:29
  • @djdomi unless your workplace has the 'not invented here syndrome', almost everything except some core apps will be thirdparty, from auth with things like keycloak to DB's, to wiki's. business admins should be able to shoehorn what they need into their environments. this is fine for serverfault. The number of files the app requests is something internal to the app itself, we cant keep track of that. – user22866 Feb 23 '24 at 18:12

1 Answers1

0

This is what seems to have worked, following this link to treat paths as being different sites, the external app i have no controll over was placed in its own virtual host, which was altered with an additional alias

Listen 4443
<VirtualHost *:4443>
   ServerAlias xxxx
   DocumentRoot /some/path
   Alias /xmg /some/path
   <Directory...>
   <Directory>
<VirtualHost>

and there reverse proxy settings were made to match the Alias:

<VirtualHost *:443>
     ... other settings 
    ProxyPass /xmg http://localhost:4443/xmg
    ProxyPassReverse /xmg http://localhost:4443/xmg
<VirtualHost>
user22866
  • 151
  • 6