AWS Route 53 and CloudFront - GrackerAI Portal
Host your GrackerAI portal at a /portal
subdirectory using AWS services to map domain.com/portal
to portal1.pseo.one
.
Create CloudFront Distribution
Navigate to CloudFront (opens in a new tab) inside the AWS console and click on Create distribution.
For the Origin domain, input portal1.pseo.one
where your portal is currently deployed. Click on Use: portal1.pseo.one.
portal1.pseo.one
Add Default Origin
After creating the distribution, navigate to the Origins tab.
We need to add your main Domain website as the default origin. This should be where your main domain.com
domain currently points to.
For instance, if your main website is hosted on:
- Vercel: Use your
.vercel.app
domain - Netlify: Use your
.netlify.app
domain - Custom hosting: Use your current hosting URL
Create a new Origin and add your main website URL as the Origin domain.
By this point, you should have two Origins:
portal1.pseo.one
(for the portal)- Your main website origin (for everything else)
Set Behaviors
Behaviors in CloudFront enable control over the subpath logic. We're creating the following routing logic:
- If a user visits
/portal/*
, proxy toportal1.pseo.one
- If a user visits any other page, route to your main Domain website
Create behavior by clicking the Create behavior button.
/portal/*
The behavior should have a Path pattern of /portal/*
with Origin and origin groups pointing to portal1.pseo.one
.
Path pattern: /portal/*
Origin: portal1.pseo.one
Click Save changes.
Preview Distribution
Test your distribution by going to the General tab and visiting the Distribution domain name URL.
- All pages should direct to your main Domain website
- Appending
/portal
to the URL should proxy to portal atportal1.pseo.one
]