Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
fix: www in custom base domain
Browse files Browse the repository at this point in the history
  • Loading branch information
eddiejaoude committed Nov 6, 2023
1 parent 9ed22cf commit f1ea98b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 3 additions & 2 deletions middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ export async function middleware(req) {
/http:\/\/|https:\/\//,
"",
);
const hostedDomains = [hostedDomain, `www.${hostedDomain}`];

// if custom domain + on root path
if (hostname !== hostedDomain && reqPathName === "/") {
if (!hostedDomains.includes(hostname) && reqPathName === "/") {
console.log(`custom domain used: "${hostname}"`);

let res;
Expand Down Expand Up @@ -58,7 +59,7 @@ export async function middleware(req) {
profile.settings.domain === hostname
) {
console.log(
`custom domain matched "${hostname}" for username "${profile.username}" (protocol: "${protocol}"))`,
`custom domain matched "${hostname}" for username "${profile.username}" (protocol: "${protocol}")`,
);
// if match found rewrite to custom domain and display profile page
return NextResponse.rewrite(
Expand Down
9 changes: 7 additions & 2 deletions pages/pricing.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,14 @@ export default function Premium({ user }) {
tiers: { Free: false, Premium: true },
},
{
name: "Hide sign up button",
name: "Removed Button",
description:
"Automatically removes the sign up button from your Profile",
'Automatically removes the "Create your Profile" button from your Profile',
tiers: { Free: false, Premium: true },
},
{
name: "Custom Domain",
description: "Use your own domain for your Profile",
tiers: { Free: false, Premium: true },
},
],
Expand Down

0 comments on commit f1ea98b

Please sign in to comment.