amazon web services - Issue with AWS Elastic Load Balancing sticky sessions - subdomains are being served from different servers? -


I'm fairly new to loading balance and I'm trying to get Amazon's elastic load balancer to play well with subdomains. There are some problems.

I have two EC2 servers behind my load balancer when I go to mydomain.com and www.mydomain.com , then let me The URL is served from various EC2 servers. I need to serve www.mydomain.com and mydomain.com on the same server so that the session works properly.

I have load balancer "stickiness" set to LBCookieStickinessPolicy so that:

Enter image details here

and my two EC2 examples are both "these services" behind my load balancer:

 Enter the image details here

I do not know if this is useful for troubleshooting, but my apache configuration looks like this:

Enter image details here

When I look at the sessions in firebug, I see the following ...

For mydomain.com .com:

Enter image details here

Mydomain.com for www (see "www.") < / P>

Enter image details here

I do not believe that Why, but there are actually two EWSELB cookies set, which are set when looking at cookies for www.mydomain.com.

I am using Zend Framework, and I am setting my cookie odomen in this way:

  Zend_Session :: Start (array ('cookie_domain' = & Gt; '.mydomain.com'));   

Before moving this site into two load balanced EC2 servers, it worked fine in the past. Our site uses some subdomains, such as api.mydomain.com and my.mydomain.com, which made cooki_domain important and, given, it can be fine. It is quite possible that once we get the load balancer session "sticky" to work properly between subdomains, the session variable will work as expected (hopefully!).

Any ideas why our site is being served from different servers "www." Is the domain name added?

Thank you!

Cookies are set by the domain, including a subdomain part when you go to a www.example. Com cookie can not be read, so ELB sets a new cookie.

To deal with this problem, you will receive all incoming requests up to 301 by an authentic domain for upacha. That is, either all * is redirected to *, or vice versa, then you only have to deal with cookies on the canonical domain, and the smoothness of your session will work as expected.

Comments