diff --git a/.env.production b/.env.production
index 550e0c24aa911625bc3ced77fca93a8091b0bf45..31ad2117f53d2b40e76814c23386cfdab406ec38 100644
--- a/.env.production
+++ b/.env.production
@@ -86,4 +86,6 @@ OPENAI_MODEL=gpt-4o-mini
 
 IP_ADDRESS_RESOLVER_URL=http://ip-api.com/batch
 IP_ADDRESS_RESOLVER_CALL_LIMIT_PER_MINUTE=15
-IP_ADDRESS_RESOLVER_MAX_IP_ADDRESSES_PER_CALL=100
\ No newline at end of file
+IP_ADDRESS_RESOLVER_MAX_IP_ADDRESSES_PER_CALL=100
+
+APP_PRIVATE_MODE_SECRET=secret
\ No newline at end of file
diff --git a/.env.testing b/.env.testing
index 28fca8c4a6dffc4d924910a81327e8849727f7a6..7e40aa8641d219fb6f21e09ad7e1760f43b7c0fe 100644
--- a/.env.testing
+++ b/.env.testing
@@ -82,4 +82,6 @@ OPENAI_MODEL=gpt-4o-mini
 
 IP_ADDRESS_RESOLVER_URL=http://api.test-provider.com/batch
 IP_ADDRESS_RESOLVER_CALL_LIMIT_PER_MINUTE=15
-IP_ADDRESS_RESOLVER_MAX_IP_ADDRESSES_PER_CALL=100
\ No newline at end of file
+IP_ADDRESS_RESOLVER_MAX_IP_ADDRESSES_PER_CALL=100
+
+APP_PRIVATE_MODE_SECRET=secret
\ No newline at end of file
diff --git a/app/Http/Middleware/CheckPrivateModeMiddleware.php b/app/Http/Middleware/CheckPrivateModeMiddleware.php
index 2e9ba639dc3fd4fac8951d165f007a3aa89a07e7..8d3bce4ee1c02b5ee4a24ea371c830217dd537ba 100644
--- a/app/Http/Middleware/CheckPrivateModeMiddleware.php
+++ b/app/Http/Middleware/CheckPrivateModeMiddleware.php
@@ -9,9 +9,14 @@ class CheckPrivateModeMiddleware
 {
     public function handle(Request $request, Closure $next)
     {
-        if (config('app.private_mode') && ! $request->is('maintenance') && ! auth()->check()) {
+        $privateModeEnabled = config('app.private_mode');
+        $privateModeSecret = config('app.private_mode_secret');
+        $userSecretInput = $request->input('secret');
+        $secretIsUsable = ! empty($privateModeSecret) && $privateModeSecret === $userSecretInput;
+
+        if ($privateModeEnabled && ! $secretIsUsable) {
             return redirect()->route('maintenance');
-        } elseif (! config('app.private_mode') && $request->is('maintenance')) {
+        } elseif (! $privateModeEnabled && $request->is('maintenance')) {
             return redirect()->route('index');
         }
 
diff --git a/config/app.php b/config/app.php
index b44d19f7b53e72e0c3756ca32a0d6d6540b17a67..2f05bd8ca266da50c348e93e6b28752dc457065a 100644
--- a/config/app.php
+++ b/config/app.php
@@ -136,4 +136,6 @@
     ],
 
     'cdn_disk' => env('CDN_FILESYSTEM_DISK'),
+
+    'private_mode_mode_secret' => env('APP_PRIVATE_MODE_SECRET'),
 ];