Skip to content

Fix: add /api/catalog to public paths in middleware#3

Merged
crarau merged 1 commit into
mainfrom
fix/catalog-endpoint-auth
Apr 20, 2026
Merged

Fix: add /api/catalog to public paths in middleware#3
crarau merged 1 commit into
mainfrom
fix/catalog-endpoint-auth

Conversation

@crarau

@crarau crarau commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

Root Cause

The /api/catalog endpoint was not listed in the middleware's PUBLIC_PATHS array. Unauthenticated requests (from ideaplaces.com product pages) were redirected to /login, causing the caller to receive a non-JSON redirect response interpreted as a 404/error.

Fix

Added /api/catalog to the PUBLIC_PATHS array in src/middleware.ts. This endpoint serves public product catalog data consumed by the ideaplaces.com website and should be accessible without authentication.

Alert Reference

Triggered by production alert at 2026-04-20T14:15:02.914Z:

8 errors: Catalog fetches to https://c3.ideaplaces.com/api/catalog are returning 404

Testing

  • Added tests/unit/middleware/public-paths.test.ts with 5 tests covering catalog, health, client-log (public), and sessions (protected) paths
  • All 158 tests pass (14 test files)
  • Build succeeds
  • Verified locally: curl http://localhost:8347/api/catalog was returning 307 redirect to /login before the fix

The catalog endpoint was behind auth middleware, causing 404/redirect
responses for unauthenticated callers (ideaplaces.com product pages).
@crarau
crarau merged commit b3ad70c into main Apr 20, 2026
2 checks passed
@crarau
crarau deleted the fix/catalog-endpoint-auth branch April 20, 2026 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant