0
votes

I have a Gatsby application with below structure:

src
|-pages
    |- dashboard.js
    |- projects.js

Once deployed on Netlify, these pages (obviously) are accessible via below URLs: https://domain.netlify.app/dashboard and https://domain.netlify.app/projects

Now our requirement is to access these pages via subdomain after configuring custom domain on Netlify. So our the URL for our dashboard page would be https://dashboard.customdomain.com and URL of projects page would be https://projects.customdomain.com

Now the questions are : (1) Whether such implementation is possible with Gatsby (2) If yes then what and where do I have to make changes to check the subdomain and accordingly serve the request.

1

1 Answers

1
votes

No, it's not easily possible. This would mean you have completely different URLs for these pages in development (e.g. the relative path /dashboard) and in production (https://dashboard....). It will also necessarily mean that your JavaScript code is duplicated between the two domains and therefore loaded twice, which seems wasteful.

If you need the pages to be on two different domains I'd suggest you develop two different projects for them.