I am trying to configure a reverse proxy to my backend server.
This is my previous configuration which is working.
Define REMOTE_ADDR proxyserver.domain.com
<VirtualHost *:443>
ProxyRequests Off
KeepAlive On
ProxyPreserveHost Off
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket
RewriteRule /prefix/(.*) wss://${REMOTE_ADDR}/prefix/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket
RewriteRule /prefix/(.*) https://${REMOTE_ADDR}/prefix/$1 [P,L]
ProxyPass / https://${REMOTE_ADDR}/prefix/ connectiontimeout=5 timeout=300
ProxyPassReverse / https://${REMOTE_ADDR}/prefix/
</VirtualHost>
This is my new configuration.
I want to redirect to:- proxyserver.domain.com/prefix/sen/app/9d12ponf12-2awf2-wafa/sheet/219uaw9dw-waf2/state/analysis
Note: The Remote address will always be the same. I have given an example but this is what it looks like in real as well.
I haven't included SSL information as that is not relevant to my problem.
Define REMOTE_ADDR proxyserver.domain.com
<VirtualHost *:443>
ProxyRequests Off
KeepAlive On
ProxyPreserveHost Off
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket
RewriteRule /prefix/sen/app/9d12ponf12-2awf2-wafa/sheet/219uaw9dw-waf2/state/analysis(.*) wss://${REMOTE_ADDR}/prefix/sen/app/9d12ponf12-2awf2-wafa/sheet/219uaw9dw-waf2/state/analysis$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket
RewriteRule /prefix/sen/app/9d12ponf12-2awf2-wafa/sheet/219uaw9dw-waf2/state/analysis(.*) https://${REMOTE_ADDR}/prefix/sen/app/9d12ponf12-2awf2-wafa/sheet/219uaw9dw-waf2/state/analysis$1 [P,L]
ProxyPass / https://${REMOTE_ADDR}/prefix/sen/app/9d12ponf12-2awf2-wafa/sheet/219uaw9dw-waf2/state/analysis connectiontimeout=5 timeout=300
ProxyPassReverse / https://${REMOTE_ADDR}/prefix/sen/app/9d12ponf12-2awf2-wafa/sheet/219uaw9dw-waf2/state/analysis
</VirtualHost>
It gives 'Too many redirects error'.
I am now stuck and can't figure how to setup rules for a URL like my REMOTE_ADDR.
Any help is appreciated.
Edit- Provided my previous working configuration and also updated my current configuration to show the relation between them.
I've written /analysis$1
and not /analysis/$1
because when I try to access my server directly, some dynamic strings are appended to it, for e.g.
/analysis?example