Skip to content

Redirecting to a holding page during development - middleware? #44954

Discussion options

You must be logged in to vote

Ok I figured it out by reading the Middleware API docs 😁

const ipAddress = request.ip
    if (ipAddress !== 'IP-ADDRESS') {
        if (request.nextUrl.pathname === '/') {
            return NextResponse.redirect(new URL('/coming-soon', request.url))
        }
    }
    return NextResponse.next()

Replies: 2 suggested answers

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by MattHeslington
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
1 participant