Is there way to bring down my Vercel hosted Next.js website?
Asked Answered
I

2

1

Lets say I wanna for some reason turn down my site, can achieve this with Vercel? Or is it better to make it via my domain register (Namecheap) or even do it completely differently through some add-on for my app (Next.js)?

I'm looking for preferably some instant "switch" solution.

Incomparable answered 28/2, 2022 at 16:20 Comment(0)
Y
3

The easiest and quickest trick I used was removing the router, layout, or pages from the root file and deploying it again. You can follow the steps below based on what kind React app you are using.

Next 13
  1. Go to app.jsx or app.tsx file.
Next 14
  1. Go to root layout.tsx or layout.jsx file.
Vite or CRA React app
  1. Go to App.tsx or main.tsx file.

Follow the steps below after choosing the step 1. based on the type of React app you're using👇👇👇

  1. Replace the return ( ... ) with whatever you like. e.g. return (<div>Under maintenance</div>)
  2. Push your changes and newly deployed release will have nothing but a a div with text "Under maintenance" ✅
Yamashita answered 1/11, 2023 at 21:0 Comment(0)
W
1

You could add basic auth in front of your website, and turn it on when you want to take the site down. You could also modify this to have it behave more like a feature flag, which if one is in "maintenance mode".

https://github.com/vercel/examples/tree/main/edge-functions/basic-auth-password

Weihs answered 2/3, 2022 at 2:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.