Expose local servers behind NAT to the internet
GitHub RepoImpressions1.7k

Expose local servers behind NAT to the internet

@githubprojectsPost Author

Project Description

View on GitHub

Expose Your Local Server to the World with FRP

Ever needed to demo a web app you're building on your laptop to a client across the country? Or maybe you've wanted to give temporary access to a local API for testing, but found yourself blocked by a router, a firewall, or the dreaded NAT? Manually configuring port forwarding is a hassle, and services like Ngrok are great but often have limits on their free tiers.

What if you had a simple, self-hosted tool to create secure tunnels from your local machine to the public internet? That's exactly what FRP (Fast Reverse Proxy) is for.

What It Does

FRP is an open-source reverse proxy that lets you expose a local server behind a NAT or firewall to the internet. At its core, it uses a client-server model. You run the FRP client on your local machine alongside your development server. The client connects outbound to an FRP server you control (which has a public IP). The public server then forwards incoming traffic back down the tunnel to your local service.

It's like giving your localhost a public-facing address, without touching your router settings.

Why It's Cool

The beauty of FRP is in its flexibility and control. Unlike some cloud-based tunnel services, you own the server component. This means you set the limits, you handle the logging, and you control the security. It's incredibly lightweight and written in Go, making it easy to deploy on everything from a Raspberry Pi to a cloud VM.

Some standout features:

  • Protocol Support: It's not just for HTTP. FRP can tunnel TCP, UDP, HTTPS, and even SSH traffic.
  • Simple Configuration: You define everything in clear TOML or INI config files—no complex GUI.
  • Dashboard: The server comes with a handy web UI to monitor active connections and traffic.
  • Security: You can add authentication tokens and specify which IPs are allowed to connect to the public port.

A classic dev use case is sharing a work-in-progress web app. Spin up your Next.js dev server on localhost:3000, fire up the FRP client, and you instantly get a public URL (like your-server.com:8080) that anyone can visit. It's also perfect for temporary access to a local database GUI, a staging environment, or a webhook endpoint during development.

How to Try It

Getting started is straightforward. You'll need a machine with a public IP address (a cheap cloud VM works perfectly) to act as the FRP server.

  1. Set up the Server: Head to the FRP releases page on GitHub, download the appropriate archive for your server's OS, and extract it. The key file is frps (the server binary) and frps.toml (its config). A minimal server config (frps.toml) might look like this:

    bindPort = 7000
    

    Run it with ./frps -c ./frps.toml.

  2. Configure the Client: On your local development machine, you'll use the frpc binary and frpc.toml file from the same release. Here's a basic config to expose a local web server:

    serverAddr = "YOUR_SERVER_PUBLIC_IP"
    serverPort = 7000
    
    [[proxies]]
    name = "web-tunnel"
    type = "tcp"
    localPort = 3000
    remotePort = 8080
    

    This tells the client to connect to your server and forward any traffic hitting the server's port 8080 to your local port 3000.

  3. Run It: Start your local app (e.g., on localhost:3000), then run the client: ./frpc -c ./frpc.toml. Now, visiting http://YOUR_SERVER_PUBLIC_IP:8080 will show your local site.

For a deeper dive, the FRP GitHub repository has excellent documentation with more advanced examples.

Final Thoughts

FRP has become a trusty tool in my dev toolkit. It solves a very specific problem—secure, controlled external access to local services—without overcomplicating things. While Ngrok is fantastic for quick, one-off shares, FRP gives you long-term, configurable tunnels on your own infrastructure. If you regularly need to provide external access during development or you just prefer self-hosted solutions, it's absolutely worth setting up.

@githubprojects

Back to Projects
Project ID: c8ee6fd5-416c-460e-9868-4177d72dcf9bLast updated: December 29, 2025 at 06:26 AM