I am trying to configure an Apache server for testing. The goal is to simulate a loadbalancer. The part we are trying to simulate is simply to accept the client secure httprquest and send it (via insecure http) to the correct server using proxypass. All this works 100%.
The problem is this: I want to use this "load balancer" for multiple development environments. To test the server side of the applications, I want proxypass to use a URL variable to navigate to the clients IP address. To do this, you need to use the variable URL in the proxypass rule. I found the variable REMOTE_ADDR, but I cannot use it in the proxypass rule. At first I tried the syntax that the Apache website told me to use, but it did not work (getting a DNS lookup error for http: // REMOTE_ADDR / foobar / ). I know that I need to do something with Interpolate, but I can’t understand what exactly will be.
This line does what it should do, so the server works fine:
ProxyPass / http: // localhost: 81 /
These are the rules that I tried (using a variable) that failed.
ProxyPass / http: // $ {REMOTE_ADDR}: 81 /
Error: [client 127.0.0.1] proxy: DNS lookup failed for: $ {remote_addr} returned /
ProxyPass / https: //% {REMOTE_ADDR} s /
Error: [client 127.0.0.1] proxy: DNS lookup error for:% {remote_addr} s, returned by /
ProxyPassInterpolateEnv On
...
ProxyPass / http: // $ {REMOTE_ADDR}: 81 / interpolation
Error: [client 127.0.0.1] parsing error URL //: 81: Invalid host / port
Is there any idea?
source
share