Skip to content

fix(proxy): handle missing locale correctly for /dashboard redirects#313

Merged
ViktorSvertoka merged 1 commit into
developfrom
fix/dev-oauth-dashboard-login-redirect
Feb 11, 2026
Merged

fix(proxy): handle missing locale correctly for /dashboard redirects#313
ViktorSvertoka merged 1 commit into
developfrom
fix/dev-oauth-dashboard-login-redirect

Conversation

@ViktorSvertoka
Copy link
Copy Markdown
Member

@ViktorSvertoka ViktorSvertoka commented Feb 11, 2026

Summary by CodeRabbit

Release Notes

  • Chores
    • Expanded environment configuration with enhanced security features including IP/header trust toggles, granular rate-limiting controls per endpoint, and emergency disable flag
    • Enhanced locale detection mechanism to improve multi-language support and routing reliability

@netlify
Copy link
Copy Markdown

netlify Bot commented Feb 11, 2026

Deploy Preview for develop-devlovers ready!

Name Link
🔨 Latest commit 954ebf2
🔍 Latest deploy log https://app.netlify.com/projects/develop-devlovers/deploys/698d0aef2bc0cf0008c42428
😎 Deploy Preview https://deploy-preview-313--develop-devlovers.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Feb 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
devlovers-net Ready Ready Preview, Comment Feb 11, 2026 11:05pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 11, 2026

📝 Walkthrough

Walkthrough

Expands frontend environment configuration with new variables across core, OAuth, Cloudinary, Stripe, admin, quiz, Telegram, and Gmail sections, plus rate-limiting and security controls. Refactors locale resolution in proxy.ts to use a dedicated helper function instead of hardcoded defaults.

Changes

Cohort / File(s) Summary
Environment Configuration
frontend/.env.example
Introduces new environment variables for core, OAuth, Cloudinary, Stripe, admin, quiz, Telegram, and Gmail SMTP configurations. Adds granular Stripe webhook rate-limiting controls, trust toggles for IP/header forwarding, global rate-limit disable flag, and concrete checkout rate-limit defaults.
Locale Resolution Refactoring
frontend/proxy.ts
Extracts locale resolution logic into a new resolveLocaleFromPathname() helper that derives locale from the second path segment using allowed locales from i18n config. Replaces hardcoded locale defaults in both authentication redirect and main proxy flows.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • AM1007

Poem

🐰 Hops through env vars with glee,
Locale paths now resolved with harmony!
From hardcoded 'en' to dynamic delight,
Rate limits and configs—all feeling so right!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title references a locale handling fix for /dashboard redirects, but the changeset primarily reorganizes environment variables in frontend/.env.example and updates proxy.ts locale resolution logic. The title is partially related—it captures one aspect (locale handling in proxy.ts) but omits the substantial .env.example changes, making it incomplete.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/dev-oauth-dashboard-login-redirect

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@frontend/.env.example`:
- Line 105: Add a trailing newline to the file so it ends with a newline
character; specifically update the .env.example so the final line
"GROQ_API_KEY=" is followed by a blank line (newline at EOF) to satisfy POSIX
tooling and static analysis.
🧹 Nitpick comments (1)
frontend/proxy.ts (1)

88-89: Remaining hardcoded locale references reduce the benefit of this refactor.

Line 89 hardcodes '/en' for the root redirect instead of using defaultLocale. Lines 68 and 81–82 (pre-existing) still use a hardcoded /(uk|en|pl) regex. Consider making these consistent with the new centralized approach so that adding or removing a locale in i18n/config.ts doesn't require touching multiple places.

At minimum, the root redirect is a quick win:

Suggested fix for line 89
-    return NextResponse.redirect(new URL('/en', req.url));
+    return NextResponse.redirect(new URL(`/${defaultLocale}`, req.url));

For the regex on lines 68 and 81–82, you could build it dynamically:

const localePattern = new RegExp(`^\\/(${locales.join('|')})(?=\\/|$)`);

Also applies to: 92-92

Comment thread frontend/.env.example

UPSTASH_REDIS_REST_URL=
UPSTASH_REDIS_REST_TOKEN=
GROQ_API_KEY= No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Missing trailing newline.

Static analysis flags no blank line at end of file. Most tools and POSIX convention expect a trailing newline.

 GROQ_API_KEY=
+
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
GROQ_API_KEY=
GROQ_API_KEY=
🧰 Tools
🪛 dotenv-linter (4.0.0)

[warning] 105-105: [EndingBlankLine] No blank line at the end of the file

(EndingBlankLine)

🤖 Prompt for AI Agents
In `@frontend/.env.example` at line 105, Add a trailing newline to the file so it
ends with a newline character; specifically update the .env.example so the final
line "GROQ_API_KEY=" is followed by a blank line (newline at EOF) to satisfy
POSIX tooling and static analysis.

@ViktorSvertoka ViktorSvertoka merged commit 44ba764 into develop Feb 11, 2026
12 checks passed
@ViktorSvertoka ViktorSvertoka deleted the fix/dev-oauth-dashboard-login-redirect branch February 11, 2026 23:07
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