I was wondering if it is possible to direct http traffic to a specific back end server, based on an http request header value. The 'referer' http header value for exemple.
I have 2 server instances. One for UAT (tests) and one for pre-production use. I would like to have an Apache reverse proxy in front of these 2 server instances. And when an http request comes, based on the 'referer' http header (uat or pre-prod) value I would like my reverse proxy to direct the request to the correct back end server instance.
Is this possible?
Thanks
Best Answer
Yes, it is possible.
Make a rewrite rule based on a conditional check of the REFERER header.
RewriteCond documentation
%{HTTP:header}, where header can be any HTTP MIME-header name, can always be used to obtain the value of a header sent in the HTTP request. Example: %{HTTP:Proxy-Connection} is the value of the HTTP header ``Proxy-Connection:''.