9 Comments

Super helpful! Any ideas how to support custom client domains?

clientdomain.com => client.app.com

Expand full comment
author

Maybe this makes more since.

the one bundle = for your app

the other bundle = for all clients domains

you just check the request.headers.get('host') value and look it up in your database.

So you can have unlimited client ones this way.

My second bundle does this, the root file returns the client's data from checking the host header in the loader and the components have all of their data unique to them

Expand full comment
author

That’s exactly what I do with this.

Check the http host header in your loader and render different things :)

Expand full comment

hey nice one, been trying to get something similar working, I had 2 questions;

1 - any chance of making an example repo?

2 - with the part of the build script `... rm -rf app/routes/__app && ...` how are you restoring your `__app` folder?

Expand full comment
author

1. No time right now sorry.

2. I’m doing this in CI so I don’t care about the folder being deleted. It does that part last and the code is all in git so it’s not an issue.

Expand full comment

Very cool - How do you handle ssl certs for the different domains?

Expand full comment
author

Like you would any other application. That has no impact on this solution.

Personally I use render.com to host my app. All I have to do is add two domains to the project and they provision the certs automatically.

Expand full comment

Nice solution! Do you run in to any problems in your development environment?

Expand full comment
author

Not really, I actually use /landing-pages route locally while in dev mode, just under a different domain from my hosts file, and then I can fully test everything before doing a prod build

Expand full comment