Using Rackspace Cloud Load Balancers as a Service to host multiple SSL Sites

A few days ago I wrote an article about using SNI to host multiple SSL sites on a single IP. This method is excellent, and it works with Rackspace Cloud Load Balancers as a Service very well. The major drawback is that if your users are using a browser that does not support SNI, they won’t get the desired results. I want to first say that I am a huge fan of SNI, and as available IPv4 addresses become fewer and fewer, I think that SNI will be the preferred method of doing this. That being said, a lot of websites simply can not afford to write off anyone with an unsupported browser. For that reason, here are instructions on using Rackspace Cloud Load Balancer as a Service to host multiple SSL sites from the same pool of Web Servers.

High Level Overview

A high level overview is that you will have 2 Load Balancers for each site. The 2 Load Balancers will share a single Public IP address. One will listen on port 80 for standard HTTP traffic and the other will listen on port 443 for HTTPS traffic. In my proof of concept below, I will have two sites: test1.com and test2.com, ergo I will have four Load Balancers.

Create the Load Balancers

Let’s create the Load Balancers. Since Rackspace Cloud LoadBalancers as a Service is only available via the API at the time of this writing, that is what we will use.

First we authenticate (Obviously change out your username and API key for the made up values:

This will return a few headers, the one we care about is X-Auth-Token.

Now using that token we will build a Load Balancer in the datacenter of our choice. For my example, I will build into the DFW datacenter. If you want to build into ORD, just change out ‘dfw’ for ‘ord’ below.

First up, create an xml file for test1-http. Let’s call it createtest1-http.xml

Those values are pretty self explanatory, but you are giving the Load Balancer a name, telling it to listen on port 80 for HTTP traffic, requesting a public IP, and assigning it two nodes that it should send traffic to on port 80 as well.

Now that we have the xml file, let’s create the Load Balancer. Change out your Auth Code and your Account number in the example below:

The important take away from above is the new Public IP address and IP address ID. We will use the ID when we build the https load balancer so that they share the same IP.

Now, let’s build the test1-https Load Balancer. First, the xml file:

The changes here are going to be that we are giving it a different name, telling the Load Balancer to listen on port 443 for HTTPS traffic, and instead of requesting a new public IP, we are asking it to use the IP that we created above. In my case, that was IP ID 88. Also, note that we are asking it to send all traffic to the nodes on port 444. That’s not a typo. In order for the web nodes to distinguish  test1.com from test2.com we are going to send the traffic on different ports.

Now, the command to create this Load Balancer is just like above:

test2-http and test2-https will be just like above, but give them different names and have test2-https send traffic to the nodes on port 445.

Configure Apache on the Individual Nodes

Ok, we now have 4 Load Balancers, now to take a look at the apache config for one of the web nodes. You will want to add the following:

That’s it – Apply those settings to all of the web nodes, open up iptables on the nodes for ports 80, 444 and 445, and start apache and you will be good to go. (Obviously, don’t forget to point DNS for test1.com to the IP of the loadbalancer for test1 and the same for test2.)

Related resource: The API guide for Load Balancers as a Service: http://docs.rackspacecloud.com/loadbalancers/api/clb-devguide-latest.pdf

I hope this helps! If anything doesn’t make sense or you have any comments leave a message below.

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">