fix: allow unauthenticated access to /login page #86

Merged
jonas.hanisch merged 1 commit from fix/login-page-json-response into main 2026-01-22 19:12:14 +00:00
Owner

Summary

  • Fix redirect loop when accessing /login without authentication
  • Only enable auth middleware when BOTH non-localhost bind AND token configured
  • Allow /login and /api/auth/* paths to bypass auth checks
  • Log warning when network access is enabled without authentication

Problem

When binding to a non-localhost address without a remote token configured:

  1. User visits / → redirected to /login
  2. Login page redirects to / (no auth configured)
  3. Infinite redirect loop

Solution

  • Auth middleware now only activates when both conditions are met:
    • Bind address is not localhost
    • CLAUDE_MEM_REMOTE_TOKEN is configured
  • If network access without auth, log warning but allow access

Test plan

  • Network access without token: works without login
  • Network access with token: login page loads correctly
  • Localhost access: always works

🤖 Generated with Claude Code

## Summary - Fix redirect loop when accessing `/login` without authentication - Only enable auth middleware when BOTH non-localhost bind AND token configured - Allow `/login` and `/api/auth/*` paths to bypass auth checks - Log warning when network access is enabled without authentication ## Problem When binding to a non-localhost address without a remote token configured: 1. User visits `/` → redirected to `/login` 2. Login page redirects to `/` (no auth configured) 3. Infinite redirect loop ## Solution - Auth middleware now only activates when **both** conditions are met: - Bind address is not localhost - `CLAUDE_MEM_REMOTE_TOKEN` is configured - If network access without auth, log warning but allow access ## Test plan - [x] Network access without token: works without login - [x] Network access with token: login page loads correctly - [x] Localhost access: always works 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix: allow unauthenticated access to /login page
All checks were successful
CI / build (pull_request) Successful in 21s
CI / validate-plugin (pull_request) Successful in 2s
88c7787ebe
The auth middleware was blocking access to /login for remote users,
returning JSON instead of the login HTML page.

Changes:
- Allow /login and /api/auth/* paths before auth checks
- Only enable auth middleware when BOTH non-localhost bind AND token configured
- Log warning when network access enabled without authentication

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
jonas.hanisch force-pushed fix/login-page-json-response from 88c7787ebe
All checks were successful
CI / build (pull_request) Successful in 21s
CI / validate-plugin (pull_request) Successful in 2s
to 5b653970b9
All checks were successful
CI / build (pull_request) Successful in 21s
CI / validate-plugin (pull_request) Successful in 2s
2026-01-22 19:11:38 +00:00
Compare
jonas.hanisch deleted branch fix/login-page-json-response 2026-01-22 19:12:14 +00:00
Sign in to join this conversation.
No description provided.