nextjs-request-url-proxy-redirect
Fix for NextResponse.redirect going to wrong host (localhost:8080) on Railway, Vercel, or containerized deployments. Use when: (1) redirects work locally but go to localhost in production, (2) console shows ERR_CONNECTION_REFUSED to localhost:8080 or similar internal URL, (3) using `new URL(path, request.url)` for redirects in Next.js API routes or middleware. The fix is to use NEXT_PUBLIC_APP_URL environment variable instead of request.url as the base URL.
Installation
Follow the repository instructions for this skill and your agent. Review the files and dependencies before adding it to your workflow.
View source ↗GuidesSkill instructions
Features and purpose
Fix for NextResponse.redirect going to wrong host (localhost:8080) on Railway, Vercel, or containerized deployments. Use when: (1) redirects work locally but go to localhost in production, (2) console shows ERR_CONNECTION_REFUSED to localhost:8080 or similar internal URL, (3) using `new URL(path, request.url)` for redirects in Next.js API routes or middleware. The fix is to use NEXT_PUBLIC_APP_URL environment variable instead of request.url as the base URL.
Quick start
Follow the repository instructions for this skill and your agent. Review the files and dependencies before adding it to your workflow.
Guides ↗Examples
Read the usage examples in the source repository.
View source ↗Source history
- Indexed on
- 2026-01-24
- Index updated
- 2026-01-24
- Branch
- main
Index and sync dates describe this directory. View the source repository for code history.
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!