2

I have one application running on AWS amplify and have a custom domain associated with the app. One of my use cases is to have a dynamic number of subdomains (per customer based) so I can have e1.example.com, e2.example.com, and so on.

But the problem is AWS amplify does not support wildcard subdomains and if I were to create subdomains programmatically, there is a limit of 50 subdomains.

So I thought of a workaround App 1 - Have a separate server with .htaccess file and wildcard subdomains App 2 - when any request comes with *.example.com it will redirect the request to newexample.com/e1 which is on AWS amplify.

Had a couple of questions around this

  • Will this going to work as App 1 will be somewhere else and will only have a .htaccess file and nothing else.
  • What could be the best place to have this redirector application? on AWS, which service can be the best fit, cost-wise too?
Mark B
  • 183,023
  • 24
  • 297
  • 295
Manoj ahirwar
  • 1,062
  • 1
  • 10
  • 24

1 Answers1

1

You can probably make this work with a simple Elastic Beanstalk application using nginx for redirection.

Another way would be to use the WEB_DYNAMIC Amplify platform which gives you access to the Amplify Cloudfront distributions. You can set up wildcard routing at the Cloudfront level, just make sure your Cloudfront default behaviour has a cache policy that forwards the host header. This would allow you to only work with *.example.com domains

BlackDog
  • 197
  • 2
  • 14