How Can I Prevent My Nuxt.js Client Side Code From Being Delivered? Similar To .htaccess

I have a Nuxt.js app that is going into production with a domain. However the app is still under construction and nobody should see client-side delivered source code yet unless they have a specific access password.

.htaccess file is something that can be done for Apache servers but Nuxt.js is using a node backend server to deliver the client-side code right? So how can I configure that node server to prompt a login (classical html login alert prompt) before delivering any client-side code?



Apache is a webserver, that have some configuration files it can read and execute accordingly. Node on the other hand uses express - http(s) server written directly for speed (faster than apache) and not using such things.

You have 2 ways of doing that i can think of fast

  • Use some other server and proxy(reverseproxy) the connections and lock the access on it (like apache proxying to nodejs).

Or a bit harder but i think better in performance and logic

  • You will need to write some global middleware, that would require some cookie value (if present, next(), otherwise show/handle login)