Fix DEV_MODE to work on production domain
Remove hostname check — DEV_MODE env var is sufficient as explicit opt-in. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
102e11725c
commit
da23d546ce
1 changed files with 2 additions and 8 deletions
10
auth.php
10
auth.php
|
|
@ -38,15 +38,9 @@ function authenticate() {
|
|||
* @return bool True if development mode
|
||||
*/
|
||||
function isDevelopmentMode() {
|
||||
// Require DEV_MODE env var to be explicitly set for localhost bypass
|
||||
// DEV_MODE env var explicitly bypasses auth (set in Apache/env config)
|
||||
$dev_mode = getenv('DEV_MODE');
|
||||
if ($dev_mode !== 'true' && $dev_mode !== '1') {
|
||||
return false;
|
||||
}
|
||||
$host = $_SERVER['HTTP_HOST'] ?? $_SERVER['SERVER_NAME'] ?? 'unknown';
|
||||
// Match localhost or 127.0.0.1 on any port
|
||||
$hostname = explode(':', $host)[0];
|
||||
return in_array($hostname, ['localhost', '127.0.0.1']);
|
||||
return ($dev_mode === 'true' || $dev_mode === '1');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue