0

My web application is hosted on AWS. It's your standard Laravel/PHP app. I would like to have a feature where users who register, have the ability to see their content in a dedicated subdomain (e.g. USERNAME.mywebapp.com)

obviously, modifying the NGINX config every time and restarting isn't going to cut it. I was wondering if AWS Route 53 offers the creation and removal of sub-domains using an API call that I can generate from my backend.

If anyone has an elegant suggestion on how I should attack this problem and aim at scalability -- i'd be happy to hear.

3

I was wondering if AWS Route 53 offers the creation and removal of sub-domains using an API call that I can generate from my backend.

You can definitely use the Route 53 API to create sub-domains, but you don't actually need to.

(e.g. USERNAME.mywebapp.com)

To support this you only need a *.mywebapp.com wildcard DNS record, as opposed to an explicit DNS record for every customer.

obviously, modifying the NGINX config every time and restarting isn't going to cut it

With regard to managing your HTTP server config:

Firstly, I wouldn't be so quick to write off modifying your HTTP server configuration then running a config reload. It's quite practical to use something like Chef to automatically manage 100's of vhost configurations from a dynamically generated source (eg. a JSON file). I've used this approach personally and it isn't as bad as it sounds.

The other option is to have your application handle sub-domain routing. Here's a Laravel example: http://laravel-tricks.com/tricks/dynamic-subdomain-routing

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.