Can two frontend services point to the same base url?

for example we have a landing page: foobar.com which runs on service A. Once a user signs in, they are redirected to foobar.com/home running on service b. And any further links from foobar.com/* are directed to service b while the baseurl foobar.com always goes to service A.
22 Replies
barry
barry11mo ago
but. why?
Wiznet
WiznetOP11mo ago
one service just runs the landing page aka foobar.com. Another service handles the authenticated experience aka foobar.com/home im just trying to determine if i should merge my landing page repo into my main frontend repo haha
Josh
Josh11mo ago
yeah this is very possible just depends where your running it and such if it's behind an nginx instance this is quite trivial regardless, most people (including me) would suggest merging the repo's, or having your 2nd project live on a subdomain and not a route level proxy on one domain this latter is how a lot of modern SaaS company's do it
Wiznet
WiznetOP11mo ago
yeah was looking at the subdomain path. landing page on foobar.com and authenticated service on app.foobar.com
Josh
Josh11mo ago
pscale, clerk, posthog, retool, etc yepp that's super common
iDarkLightning
iDarkLightning11mo ago
If this is an option, do it
Josh
Josh11mo ago
that way your landing page can be controlled by your marketing team and the actual app can be your core eng team so marketing doesn't need to have 1000 slack calls with you to update the landing page
Wiznet
WiznetOP11mo ago
yeah thats why i was hoping to avoid merging the two. our marketing team knows how to update the text fine on our repo via prs. but i really dont want to spam our eng team with text updates
Josh
Josh11mo ago
exactly yeah do the subdomain route it's much more common you doing even have to authenticate on the tld
Wiznet
WiznetOP11mo ago
well cool. ill go and see how vercel supports it
Josh
Josh11mo ago
just make your sign in button a redirect to the subdomain, and redirect /sign-in on the subdomain if the user is already logged in to their home page it is
Josh
Josh11mo ago
we basically do this with https://biblish.com
Biblish
Biblish
Bringing literature to the 21st century
Josh
Josh11mo ago
but instead of 1 subdomain we have a bunch all hosted on Vercel
Wiznet
WiznetOP11mo ago
whats the setup look like to point service b to the subdomain?
Josh
Josh11mo ago
but like 5 different projects service b is just another app on vercel
Wiznet
WiznetOP11mo ago
right ive got my two apps up is it just the domain setting?
Josh
Josh11mo ago
a subdomain is it's own domain, it just lives under the other one on the DNS level kinda yeah literally just domain settings
Wiznet
WiznetOP11mo ago
ahh i see im guessing ill have to actually setup the subdomain on my name providers site sounds like its hosted under a different ip then
Josh
Josh11mo ago
go to your DNS provider or whatnot and put in the records Vercel gives you, one for landing and one for app right
iDarkLightning
iDarkLightning11mo ago
I think you can do fancy shit with vercel but I don't think it's worth it
Josh
Josh11mo ago
if your on Vercel, technically, everything is on some random ass domain more less but yeah
Wiznet
WiznetOP11mo ago
awesome ok thanks guys. this was super helpful
Want results from more Discord servers?
Add your server