I have a rewrite rule to fetch some data from remote url(on a different server under my control) as follows:
RewriteRule ^/.+/remote_dir/(.*) http://18.104.22.168/remote_dir/$1 [P]
The remote server has htpasswd authentication which needs to be bypassed for this particular request. I cant use allow from ip as ip logged is of gateway (which will allow passwordless access to all machine behind the gateway).
So I thaught of passing env variable with this request and based on the its value bypass authentication (22.214.171.124 is also on apache).
But I cant seem to find a solution for this problem. I know there are other solutions like using common ldap auth/ or same user/pass on both servers but I dont want to use it as 126.96.36.199 is on a public ip(cloud infrastructure).
Kindly help me with a solution for this.