Another Newbie Question: multiple URLs in a load-balanced environment

187 views
Skip to first unread message

James Lampert

unread,
Apr 28, 2017, 7:51:08 PM4/28/17
to gce-discussion
I'm aware that it's possible to have multiple DNS-registered domains pointing to a single server instance on a single box at a single IP address, and yet each URL takes one to a different place in the server's directory tree.

I haven't a clue how this works (even though I can make an IBM AS/400 do almost anything short of singing a chorus of "Melancholy Baby"), but I see it in action regularly. In fact, our own company web site has three different domains, each landing on its own home page.

My question is what happens if we were hosted on one or more load-balanced Google Cloud Compute Engine instances?

Say, we want "foobar.com" to go to an enrollment and billing site for a SAAS web application, and "foobar.net" to go to the sign-on page for the application itself. Obviously this can be done with a single web server, but what happens if we were to add load balancing?

--
JHHL

Kamran (Google Cloud Support)

unread,
Apr 28, 2017, 11:11:46 PM4/28/17
to gce-discussion
Hello James,

Although multiple domains can be pointing to a single IP address assigned to a single web server instance, however web server can performance different tasks or route the requests based on HTTP request-header. As such, you can configure multiple virtual hosts (server blocks) on a single web server. Web server reads Host headers of requests and routes them to appropriate virtual hosts. (Please visit this serverfault.com thread for some examples)

That being said, since Google Cloud Load Balancer doesn't strip out Host request-header field, you should be able serving different domains/websites on a single virtual machine behind an LB. 

I hope this helps.

Sincerely,
Reply all
Reply to author
Forward
0 new messages