ReverseProxy Wildcard

apache-2.4mod-proxyproxypassreverse-proxyrhel5

Is it possible to have a wildcard for a reverse Proxy using ProxyPass?

I've seen similar config below for ProxypassMatch, so I tried to model it off of that using just proxypass

ProxyPass ^/retirement-readiness-savings(.*)$ http://prod-domain-com-2018.azurewebsites.net/retirement-readiness-savings-november-2018/$1

Issue I'm having is with character limits(25) on directory names in our new CMS.

Full URL for example below:
/retirement-readiness-savings-november-2018

For Ex with Reverse Proxy config below:

#ProxyPass ^/retirement-readiness-savings(.*)$ http://prod-domain-com-2018.azurewebsites.net/retirement-readiness-savings-november-2018$1
#ProxyPassReverse ^/retirement-readiness-savings(.*)$ http://prod-domain-com-2018.azurewebsites.net/retirement-readiness-savings-november-2018$1

So as long as the URL Matches the first 3 words it would still host the same page, ignoring november-2018

Only have ProxyPass installed and using httpd.conf to manage ReverseProxy

We are using RHEL 5.11 with mod_proxy module installed

EDIT: What I'm trying to do is catch/check the first 25 characters of the directory path, but still map to the full azure path.

Best Answer

It's not clear to me where the 25 char restriction is, but perhaps you want to do something like this?

ProxyPass ^/site/(.{1,25}).*$ http://prod-domain-com-2018.azurewebsites.net/site/$1

That would capture the first 25 chararcters after /site/ and then use that in the mapping, for example, a request for this:

/site/retirement-readiness-savings-some-thing-or-other

... would map to this:

http://prod-domain-com-2018.azurewebsites.net/site/retirement-readiness-savi

('retirement-readiness-savi' == 25 char limit)

Related Topic