You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Ron <ro...@gmail.com> on 2014/12/03 23:53:55 UTC

[users@httpd] configuring reverse proxy to variable amount of backends

Hi list,

I have been wrestling on and off with this problem for multiple years. I
had some time to spare
today, so I looked into it once again, but can seem to make any progress.

Basically I want to accomplish the following: on a webpage (connected to
the public internet, but behind a login page)
I offer a list of devices that are on an internal network. The model and
brand of these devices vary.
I need to create a link for each device, so that apache proxies requests
for those devices.

Currently I use the following path: /dev/x.x.x.x/ and the following proxy
configuration:

<Proxy *>
  Order deny,allow
  Allow from all
</Proxy>

# put /dev/ in front of every redirect you get from every host
ProxyPassReverse /dev/ http://

RewriteEngine on
#RewriteLog /var/log/httpd/rewrite.log
#RewriteLogLevel 8

<Directory /usr/local/astium/web/html>
  RewriteEngine on
  RewriteRule ^dev/([0-9.]*)/(.*)  http://$1/$2 [P]
</Directory>

I created this config several years ago, but it is seriously lacking.
html/javascript links are not
replaced, and absolute paths returned by the device make the browser lose
track.
Using proxy_html, and can fix the inline links, but the fact that the
backend hostname
is not fixed, but dynamic makes things complicated.

I found http://www.apachetutor.org/admin/reverseproxies, which offered:

ProxyRequests off
ProxyPass /app1/ http://internal1.example.com/
ProxyHTMLURLMap http://internal1.example.com /app1

<Location /app1/>
        ProxyPassReverse /
        ProxyHTMLEnable On
        ProxyHTMLURLMap  /      /app1/
        RequestHeader    unset  Accept-Encoding
</Location>

But I do not know how to map this to a backend with a variable address. For
example
I might be able to use LocationMatch, but how do I reference the matched
ipaddress
in the Location Directive in the ProxyHTMLURLMap?

Good anyone give me some ideas how to approach this?

Thanks very much,
Ron Arts