- Home
- Skills
- APIs & Backend
- Repair Redirect, Proxy & Routing Failures
More screenshots
Works with the AI Agents you already use
Repair Redirect, Proxy & Routing Failures
Repair Redirect, Proxy & Routing Failures is a bounded ToolForge Labs workflow.
$1
Repair Redirect, Proxy & Routing Failures
Example session with this skill installed
Our Next.js app is behind an Nginx proxy. Requests to /dashboard are looping with 301s. It seems like the app thinks it is on HTTP while Nginx is handling SSL. Fix the middleware and Nginx config.
- Read your context and instructions
- Compiled the repair redirect proxy
I have analyzed the Nginx configuration and the Next.js middleware. The redirect loop is caused by the application failing to recognize the X-Forwarded-Proto header, leading it to attempt a redirect to HTTPS which the proxy then terminates and passes back as HTTP.
Proxy and Middleware Repair
# Updated Nginx Location Block
location / {
proxy_pass http://nextjs_upstream;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
# Ensure these headers are explicitly set for the application
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
// middleware.ts or next.config.js Trust Logic
// Ensure the application trusts the proxy headers to determine the protocol
export function middleware(request) {
const proto = request.headers.get('x-forwarded-proto');
const host = request.headers.get('host');
// Logic to prevent internal loops
if (proto === 'http' && process.env.NODE_ENV === 'production') {
return NextResponse.redirect(`https://${host}${request.nextUrl.pathname}`, 301);
}
}
| Component | Invariant | Repair Action |
|---|---|---|
| Nginx | Must pass $scheme to X-Forwarded-Proto | Added explicit header propagation in location block. |
| Next.js | Must respect X-Forwarded-Proto for SSL detection | Updated middleware to check headers before issuing 301. |
| Trust Boundary | Application must trust Nginx IP range | Verified trust is restricted to the local VPC subnet. |
Next steps
- Apply the Nginx configuration changes and reload the service using
nginx -s reload. - Deploy the updated middleware to your staging environment.
- Verify the fix by running
curl -I -H "X-Forwarded-Proto: http" https://yourdomain.com/dashboardto ensure only one redirect occurs.
Connects securely to your tools. The creator never sees your data.
About this skill
Repair Redirect, Proxy & Routing Failures is a bounded ToolForge Labs workflow. Repair reverse-proxy, redirect, forwarded-host/protocol/path, route-prefix, canonical URL, and proxy-trust failures. Works from repositories or partial configs/logs. Produces bounded repairs and deterministic tests while preserving authentication, trusted-proxy policy, tenant routing, path protections, and documented external URLs. It works from a full repository or partial evidence such as snippets, logs, configuration, traces, tickets, and architecture notes. The skill preserves existing product and security policy, separates verified facts from assumptions, avoids invented execution claims, and produces concrete repair or review steps with focused deterministic validation or traceable evidence.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for APIs & Backend.
Cannot verify production systems, external services, or facts that are not present in supplied evidence. With partial context it returns bounded diagnosis/review, explicit assumptions, and a deterministic validation plan rather than claiming successful execution.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 2 months ago
Permissions
Use a clean branch or a controlled review workspace. Supply repository files, logs, traces, configuration, or evidence needed for the task. Review all patches/findings before merge or operational action; keep production credentials and destructive production actions out of the workflow.