Note that there are some explanatory texts on larger screens.

plurals
  1. POSticky session for load balancing with multiple domains
    primarykey
    data
    text
    <p>so here is the scenario, i have a couple of load balanced servers, with a bunch of domains pointing to the load balancer IP. The website shows a different skin depending on the domain it was accessed from (this works fine). To assure session with the load balancing i used sticky session, problem is from what i know (which is not much) i need to define the domain for the cookie, but we have multiple possible domains.. i define the cookie as following on each web server:</p> <pre><code>RewriteEngine On RewriteRule .* - [CO=BALANCEID:balancer.lb1:.domain1.com] </code></pre> <p>since we have multiple domains, i thought i could add a rewrite rule for each domain and apache would deal with that, something like this:</p> <pre><code>RewriteEngine On RewriteRule .* - [CO=BALANCEID:balancer.lb1:.domain1.com] RewriteRule .* - [CO=BALANCEID:balancer.lb1:.domain2.com] RewriteRule .* - [CO=BALANCEID:balancer.lb1:.domain3.com] RewriteRule .* - [CO=BALANCEID:balancer.lb1:.domain4.com] </code></pre> <p>but as you probably have figured out by now, the sticky session works fine only for domain1.com, the first on the list.</p> <p>Any idea how to tackle this?</p> <p>EDIT:</p> <p>I am now trying this approach:</p> <pre><code>RewriteEngine On RewriteCond %{HTTP_X_FORWARDED_HOST} ^(www\.)?domain1\.com/ [NC] RewriteRule .* - [CO=BALANCEID:balancer.lb2:.domain1.com] [L] RewriteCond %{HTTP_X_FORWARDED_HOST} ^(www\.)?domain2\.com/ [NC] RewriteRule .* - [CO=BALANCEID:balancer.lb2:.domain2.com] [L] RewriteCond %{HTTP_X_FORWARDED_HOST} ^(www\.)?domain3\.com/ [NC] RewriteRule .* - [CO=BALANCEID:balancer.lb2:.domain3.com] [L] </code></pre> <p>but its not working at all, are those rules wrongly written or that logic simply wont work?</p> <p>PS: i also tried with HTTP_HOST instead of HTTP_X_FORWARDED_HOST but it had the same result. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload