9 Comments
User's avatar
Rafael's avatar

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

clientdomain.com => client.app.com

Zach Silveira's avatar

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

Zach Silveira's avatar

That’s exactly what I do with this.

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

John's avatar

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?

Zach Silveira's avatar

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.

Knott's avatar

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

Zach Silveira's avatar

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.

Darren's avatar

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

Zach Silveira's avatar

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