bootstrap-client-ip

Parse forwarding headers to resolve real client IPs for Phoenix requests.

1|Updated May 7, 2026
One-click install
npx skills add https://github.com/agoodway/GoodSkills --skill bootstrap-client-ip
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bootstrap-client-ip
Source: https://github.com/agoodway/GoodSkills/tree/main/skills/bootstrap-client-ip
Command: npx skills add https://github.com/agoodway/GoodSkills --skill bootstrap-client-ip

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It helps you fix incorrect client IP detection in a Phoenix app running behind reverse proxies by deriving the real originating IP from standard proxy headers.

Core Features & Use Cases

  • Client IP resolution with trusted proxies: Extracts the real IP from Fly.io, Cloudflare, and typical X-Forwarded-For / X-Real-Ip headers while skipping trusted proxy CIDRs to reduce spoofing risk.
  • Phoenix plug integration: Creates a plug that assigns :client_ip and :client_ip_string onto conn.assigns for downstream controllers and LiveViews.
  • Config-first setup: Adds default header priority and trusted proxy configuration in config/config.exs, with optional runtime overrides.

Quick Start

Ask your agent to bootstrap client IP handling in your Phoenix 1.8 project by running the bootstrap-client-ip skill and wiring its plug into the browser (and optionally API) pipelines.

Frequently Asked Questions about bootstrap-client-ip

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I get the real client IP in Phoenix when conn.remote_ip shows the reverse proxy address?

To resolve the real client IP in Phoenix, you can parse forwarding headers like X-Forwarded-For while skipping trusted proxy hops. This approach extracts the originating IP from the header chain and assigns it to conn.assigns for accurate downstream usage.

What is a trusted proxy range and why is it needed for X-Forwarded-For parsing?

A trusted proxy range is a configurable CIDR block identifying legitimate reverse proxies like Cloudflare or Nginx. Skipping these IPs when parsing the X-Forwarded-For chain ensures you extract the actual client IP and reduces the risk of IP spoofing from malicious headers.

How do I configure client IP resolution for a Phoenix app deployed on Fly.io?

You can configure client IP resolution for Phoenix on Fly.io by setting up a dedicated module to parse proxy headers and adding a plug to your router pipelines. Default header priority and trusted proxy ranges can be set in config/config.exs.

Does this client IP resolution approach work with both API and LiveView pipelines in Phoenix?

Yes, the client IP resolution approach works with both API and LiveView pipelines in Phoenix. By wiring a dedicated plug into your browser and API pipelines, it assigns the resolved client IP and its string representation to conn.assigns for downstream controllers.

What is the best way to handle X-Forwarded-For header spoofing in Phoenix?

The best way to handle X-Forwarded-For spoofing in Phoenix is to configure trusted proxy ranges and parse the header chain from right to left, skipping known proxy IPs. This ensures only legitimate proxy hops are bypassed to find the real client.