Question

How to setup subdomain with DO Apps and Namecheap?

Posted December 17, 2020 474 views
DjangoDigitalOcean App Platform

The DO Apps platform is pretty new and I am not sure if this functionality already exists or not.

I am thinking to set up our dev and stage env at subdomains with Namecheap. for example www.dev.example.com, www.stage.example.com at www.example.com.

Dev and stage will have their own separate app configured with respective GitHub branches but I will be pointing them to these subdomains via Namecheap.

Another nice to have functionality will be to restrict access to the subdomains (dev, stage) via Okta or Microsoft authenticator but it is not necessary right now.

So, is there any solution or guide that already exists?
Is theoretically possible?
Is there any guide available for this?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hello, thanks for trying out DigitalOcean App Platform.

With respect to subdomains and different apps, this should be possible and pretty straight forward.

Here is relevant Namecheap documentation.

For example with the “dev” app you would do something like this:

  • Create an app pointing the source to the dev branch. Once built and deployed you would have an app with domain something like my-dev-app-zzyxx.ondigitalocean.app and you should be able to access the app at that url.
  • From here go into settings tab and configure a domains, by adding a domain. First add dev.example.com. Since you are managing your own DNS via Namecheap, select that option. The interface should give you instructions to create a CNAME record. In Namecheap create a CNAME record that points the host dev to my-dev-app-zzyxx.ondigitalocean.app.
  • Now repeat the same steps for the www.dev host, add it in App Platform domains, and add CNAME record in Namecheap with host www.dev pointing to my-dev-app-zzyxx.ondigitalocean.app. Alternatively, for this 2nd step, instead of adding the domain in App Platform and adding another CNAME record; you may be able to just create a permanent URL Redirect Record within Namecheap, so that host www.dev redirects to https://dev.example.com (the subdomain you want just without the “www”). See documentation on adding subdomains. Note that this approach will result in HTTP (for www subdomain) to HTTPS redirect.

For staging app, follow the same steps.

With respect to secure access for subdomains, it is something we are exploring, but I do not have any public timeline for this feature, or details how it may work. For now this would have to be implemented within your application. In simplest form, this can be done by utilizing Basic access authentication protocol. Okta or Microsoft, or LDAP access management would be more complex, and would have to be done all within the application as well.

Hope this is helpful.