Protect whole website


Hello, how would I be able to password protect my whole website? So when someone enters the side it asks for a password, it then shows the html content of the website.


Depends on how hard authorization u want


Just a standard pop up window (for example one that happens when you try to access the router settings) and when you type the correct details it allows you into the website (displaying html) QnUZW


I personally use passport.js for my authorization and it works best for me u can see it here if u want example ( Beta


Hey @SpeedyCraftah if you’re looking for something as simple as possible you could use Basic Auth inside Express. The npm module express-basic-auth provides a pretty easy way to enable that in an Express-based site, and allows reasonably straightforward configuration.

Whether this is sufficient for you depends on what you’re trying to protect against. This StackOverflow answer gives a pretty good overview of the things you should consider.

1 Like