nextjs-request-url-proxy-redirect

Community

Ensure redirects always use the public URL.

Authorstrataga
Version1.0.0
Installs0

System Documentation

What problem does it solve?

When deploying Next.js to containerized environments like Railway, Vercel, or Docker, NextResponse.redirect can end up using an internal proxy URL (for example, http://localhost:8080) instead of the public domain, causing ERR_CONNECTION_REFUSED. This skill guides you to always use a public base URL for redirects.

Core Features & Use Cases

  • Replace request.url with a public base URL derived from an environment variable NEXT_PUBLIC_APP_URL.
  • Provide a reusable helper (getBaseUrl) to centralize the base URL logic.
  • Works across containerized deployments (Railway, Vercel, Docker) for API routes and middleware redirects.

Quick Start

Set NEXT_PUBLIC_APP_URL in your environment (e.g., https://example.com). Update redirect logic to use a baseUrl derived from NEXT_PUBLIC_APP_URL, and optionally expose a helper like getBaseUrl() to keep redirects consistent.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: nextjs-request-url-proxy-redirect
Download link: https://github.com/strataga/claude-skill-inception/archive/main.zip#nextjs-request-url-proxy-redirect

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.