Home
Support Forums

How can I preserve the subdomain and cert logic of my current site?

I have a legacy app I am looking at moving over and have a few initial questions before I get started. I would appreciate feedback on preserving the following subdomain logic when my domain is resolved to netlify.

  1. The current app handles subdomain requests with custom branding for each registered company. foo.example.com

  2. The subdomains also drive branding inside the app. foo.example.com/feature

  3. There is a wildcard SSL cert to handle these subdomains.

  4. There is one special (of course there is) company that cannot use the wildcard cert and has their own cert. special.example.com

Assuming the legacy app will be moved to app.example.com

My questions are:

  1. Can I have these dynamic subdomains map into the existing app with _redirects?

I see examples of * mapping to :splat, and :placeholders, can I mix & match them in one rule? Something like (not sure on ordering):

https://:company.example.com/* https://:company.app.example.com/:splat 200
https://example.com/* https://app.example.com/:splat 200
  1. How can I resolve the special cert from #4 above? Do I create a site with a custom domain in netlify for special.example.com and then map this cert to it and have it used instead of the wildcard? Do I need to call out the special subdomain as a 3rd rule in redirects? (probably before the other two)

Thanks for helping me on this,
Robert

Hey Robert,

Good questions and I’ll try and cover them as best as I can! Do let me know if anything requires further clarification.

  1. I’ve just checked this out on a test site and you can use a placeholder from a path, in to a URL :tada: i.e. /:placeholder https://:placeholder.example.com 302. Here’s an example of that. However, you cannot use a placeholder in a URL, in to a URL, i.e. https://:placeholder.example.com https://:placeholder.app.example.com.

  2. For the site which won’t be able to use the wildcard cert, they’ll need to be on a standalone site where you can upload a custom certificate. This is because our wildcard subdomain feature will inhibit the ability to use domain aliases on the site. It can be linked to the same repo, mind you, so it shouldn’t disrupt your workflow too much.

Here’s a similar post where I talk about wildcard subdomains, the limitations and what you should be aware of. Familiarise yourself with it and please do let me know if you meet the criteria, are happy with said limitations and would like us to proceed!

1 Like

Hi Pie, thanks for the answers.

I think I am going to try this all out with a mirror of what we have on prod with a new domain and certs.

Is it cool to keep this thread going for any questions / issues I run into while I work through this?

Hey @RobertBright,

That’s absolutely fine! I’d implore you to give it a trial run on a staging setup. By all means, let’s keep the dialogue open – we’d be happy to help :mage: