I am trying to figure how to handle multiple domains with the same app
Say I have a “domain1.com” and “domain2.net” they are getting rendered by the same app, however each of them have their own look and data. (Domain1 is pink but Domain2 is green, …)
The app renders based on some properties from DB and looks different on each domain
I’ve searched and found some old posts but they dont make it clear if what I want to do is possible??
Welcome to the forums and thanks so much for reaching out! Yep, this is possible you can setup a redirect to different subdomains. Heres a support guide that dives a bit deeper in how to accomplish this.
Thanks for the response
I dont want to redirect domains! The visitors suppose to stay in the original domain.
it is what I am trying to do:
1- visitors hit the domain1.com
2- my application pulls data specific for the domain1.com
3- and then the app gets rendered based on the data
again, the visitor stays in the domain1.com
@mobayen What you want to do is possible and could be achieved multiple ways.
In a Jamstack fashion one way you could do it would be with a single shared codebase that is configured as two (or more) sites and when the build is executed it outputs a different result based on knowing which site it should generate (which it could determine via an environment variable, or build flag, or unique site id etc).
@nathanmartin I dont think it count as a jamstack. I am developing a Vue/NuxtJs app. so it is an SSR app.
That means I need the domain-name/hostname on the Serverside to be able render the website properly
Normally it would be done like event.req.hostname, however it returns “localhost” regardless what is the real-hostname