A Domain Name System (DNS) problem: (also asked on stack-overflow)

I've got an Amazon Web Services (AWS) Elastic Beanstalk (EB) site with potentially thousands of subdomains.

Apparently it's not possible to use A-records with AWS, as they do server balancing and have shifting IP addresses.

So far I've setup a CNAME record:

www CNAME http://mysite.elastic-beanstalk.com.

and a web forward, to handle requests to the 'naked' domain.

@ / http://mysite.elastic-beanstalk.com

I now need to map the subdomain urls to the correct place:

url typed and seen by the user >> currently live and working page

subdomain1245.mysite.com >> http://subdomain1245.mysite.elastic-beanstalk.com, www.subdomain1245.mysite.com >> http://subdomain1245.mysite.elastic-beanstalk.com


The closest tutorials I could find mentioned 'wildcard' DNS matching, like:

* CNAME http://mysite.elastic-beanstalk.com.

I tried the latter, and from what I could tell from testing, it simply redirected all subdomains to the main domain.

I need the subdomains to both stay shown in the url, and redirect to the subdomain page.

If anyone could show - and ideally explain - a strategy it would be tremendously helpful!


New clue:

using the * CNAME http://mysite.elastic-beanstalk.com., visiting subdomain1245.subdomain1245.mysite.com serves up the correct page (subdomain1245.mysite.elastic-beanstalk.com).

We have found another possible option: deleting the * CNAME http://mysite.elastic-beanstalk.com. DNS record, and instead using a Web Forward: * / http://mysite.elastic-beanstalk.com Though this too seems to need some server configuration...(???)

The app is rails, and the AWS EB instance type is ruby 2.0 passenger-standalone.

It seems that convention for modifying EB servers is via .config files in a /var/app/current/.ebextensions/ folder (this is in the rails project root, and is added to the project git repo).

No idea how to handle the subdomain with (phusion) passenger, or how to configure that via a .ebextensions/???.config file...

Are we on the right track, even? Hmmm



  • 1
    It sounds like your issue is actually with how to configure your HTTP server to route subdomains to the appropriate vhost. httpd.apache.org/docs/2.2/vhosts/mass.html – thexacre Oct 31 '15 at 23:54
  • Thanks @thexacre - The subdomains are all fully functional on the elastic-beanstalk site - subdomain1325.mysite.elastic-beanstalk.com renders the correct page. Does the server need to be modified if the 'aliasing' domain name is modified/changed? Sorry if this is a silly question, I am very new to this domain! Thanks for your help! – Peter Ponderer Oct 31 '15 at 23:58

Ah!!! In the end it was a rails configuration problem! In --config ----settings ------production.yaml

subdomain: tld_length: 1 domain: 'webweka.com'

tld_length was set to 2, to handle the subdomained elastic beanstalk address xxx.elasticbeanstalk.com

setting it back to 1 has handed the subdomain correctly!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.