Skip to content

Commit

Permalink
Update middleware.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
DinerIsmail committed Oct 1, 2023
1 parent 98736cc commit 23af6a9
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,18 @@ export default function middleware(req: NextRequest) {
})
}

const currentHost =
process.env.NODE_ENV === 'production' && process.env.VERCEL === '1'
? hostname
.replace(`.cambridgeresilienceweb.org.uk`, '')
.replace(`.resilienceweb.org.uk`, '')
.replace('.vercel.app', '')
: hostname.replace(`.localhost:3000`, '')

let currentHost
if (process.env.VERCEL_ENV === 'preview') {
currentHost = hostname.replace(`.${process.env.VERCEL_URL}`, '')
} else {
currentHost =
process.env.NODE_ENV === 'production' && process.env.VERCEL === '1'
? hostname
.replace('.cambridgeresilienceweb.org.uk', '')
.replace('.resilienceweb.org.uk', '')
: hostname.replace(`.localhost:3000`, '')
}

console.log('DINER2', {
VERCEL_URL: process.env.VERCEL_URL,
Expand Down Expand Up @@ -82,3 +87,4 @@ export const config = {




0 comments on commit 23af6a9

Please sign in to comment.