Skip to content

fix(auth): resolve production redirect loop and streamline action exports - #100

Merged
saifulalomdev merged 1 commit into
mainfrom
features
Jun 17, 2026
Merged

fix(auth): resolve production redirect loop and streamline action exports#100
saifulalomdev merged 1 commit into
mainfrom
features

Conversation

@saifulalomdev

Copy link
Copy Markdown
Owner

📝 Description

This PR resolves an infinite redirection bug on production environments caused by Cloudflare proxy cookie drops. It also optimizes the global server actions index file for cleaner exports.

Key Changes:

  • Edge Cookie Alignment: Adjusted auth_token configuration to sameSite: 'lax' and bound it directly to context.url.hostname. This ensures that proxy layers across Cloudflare Pages handle the HTTP header accurately.
  • Streamlined Exports: Converted the individual login/logout imports in src/actions/index.ts into a clean object spread pattern (...auth). This completely eliminates the need to manually touch the root index whenever a new auth action is written.
  • Formatting Pass: Removed dead comment strings and fixed formatting/trailing space inconsistencies inside use-action.ts and auth.hooks.ts.

Fixes # (issue number)

🧪 Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor / Chore (codebase maintenance or optimization)

🛠️ How Has This Been Tested?

  • Verified production login cycles across live environments, confirming successful dashboard redirection without fallback rejection loop behavior.

  • Validated server-wide compilation states against the dynamic spread ...auth configuration format.

  • Unit/Integration tests added/passed

  • Local manual edge verification successful

📸 Screenshots / Diffs (if applicable)

Modified Files:

  • src/actions/index.ts
  • src/hooks/use-action.ts
  • src/modules/auth/auth.actions.ts
  • src/modules/auth/auth.hooks.ts

✅ Checklist

  • My code follows the brutalist/minimal style guidelines of this project
  • I have performed a self-review of my own code
  • My changes generate no new typescript compiler or linter errors

…orts

- Update `auth_token` cookie settings to use `sameSite: 'lax'` and explicit `domain` to fix Cloudflare proxy dropping issues
- Refactor `src/actions/index.ts` to wildcard-import and spread all auth actions (`...auth`)
- Clean up minor spacing inconsistencies and formatting artifacts across auth hooks and actions
@saifulalomdev
saifulalomdev merged commit 90ed9ed into main Jun 17, 2026
1 check passed
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