We're using httpd as a reverse proxy to 3 back end application servers. We have a landing page for users to select their geographical region. Everything works as expected with the current setup, however, we'd like users to not have to re-select their region on return visits.
So, ideally we set a cookie (or two) and use mod_rewrite to direct requests that have the cookie(s) in place.
I have not been able to get this working as I am not that familiar with what I need to be redirecting on. I'm assuming I need to do something like:
I added this inside of the landing page directory block, but is just sent the request into a redirect loop. Here is the whole virtualhost block:
<VirtualHost *:443>
SSLEngine on
SSLProxyEngine on
SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
SSLHonorCipherOrder On
SSLCompression off
SSLUseStapling on
SSLSessionTickets Off
SSLCertificateFile /etc/pki/tls/certs/server.crt
SSLCertificateKeyFile /etc/pki/tls/certs/server.key
Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains"
Header always set X-Frame-Options DENY
Header always set X-Content-Type-Options nosniff
Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
Alias "/balancermanager" /var/www/html/balancermanager
<Location /balancermanager>
SetHandler balancer-manager
Order Deny,Allow
Deny from all
Allow from 10.1.1.10
</Location>
DocumentRoot /var/www/html/home
<Directory /var/www/html/home>
FallbackResource /index.html
Require all granted
AddType text/html html
AddType text/css css
AddType image/svg+xml svg
AddType image/jpeg jpeg jpg jpe png
</Directory>
<Proxy balancer://balancer_nodes>
ProxySet lbmethod=bybusyness
</Proxy>
ProxyRequests Off
ProxyPreserveHost On
ProxyPassMatch .*\.php$ !
ProxyPassMatch .*\.asp$ !
ProxyPassMatch .*\.pl$ !
ProxyPassMatch .*\.pm$ !
ProxyPassMatch .*\.rb$ !
ProxyPassMatch .*\.py$ !
ProxyPass /balancermanager !
Alias "/favicon.ico" /var/www/html/home/favicon.ico
ProxyPass "/US/en_US/" balancer://balancer_nodes/US/en_US/ stickysession=ROUTEID
ProxyPassReverse "/US/en_US/" balancer://balancer_nodes/US/en_US/ stickysession=ROUTEID
ProxyPass "/CA/en_CA/" balancer://balancer_nodes/CA/en_CA/ stickysession=ROUTEID
ProxyPassReverse "/CA/en_CA/" balancer://balancer_nodes/CA/en_CA/ stickysession=ROUTEID
</VirtualHost>
Any guidance is greatly appreciated.