Skip to content
xbal023Public

About

A high-performance, standalone Golang Reverse Proxy with Auto-SSL and Dynamic Header Injection. Perfect for API gateways and data scraping.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoProx 🛡️

A Standalone, High-Performance Golang Reverse Proxy with Auto-SSL & Header Injection

Go Report Card License: MIT


GoProx is a lightweight, zero-dependency reverse proxy written purely in standard Go. It is designed to act as a robust entry point for web services, APIs, and data scraping operations. It seamlessly handles automatic Let's Encrypt SSL generation, dynamic routing, and HTTP header manipulation without the need for complex web servers like Nginx or tools like Certbot.

✨ Features

  • 🚀 Zero Dependencies: Built entirely using Go's standard library (net/http, httputil, etc.).
  • 🔒 Auto-SSL (Let's Encrypt): Automatically provisions and renews SSL certificates on-the-fly when an allowed domain is accessed. No cronjobs or certbot scripts required!
  • 🔀 Dynamic Routing: Route incoming requests to different target backends based on the requested Host.
  • 💉 Header Injection & Manipulation: Perfect for API gateways or data scraping. Easily spoof User-Agent, inject Authorization tokens, or modify any HTTP headers transparently.
  • 🛡️ Secure by Default: Prevents Let's Encrypt rate limits and "Domain Fronting" by validating incoming SSL requests against your predefined routing configuration.

🛠️ Installation

Ensure you have Go 1.21+ installed on your machine.

  1. Clone the repository:

    git clone https://github.com/yourusername/goprox.git
    cd goprox
  2. Build the binary:

    go build -o goprox

⚙️ Configuration

Routing and header manipulation are controlled entirely by a simple routes.json file. Create a file named routes.json in the same directory as the executable.

Example routes.json

[
  {
    "host": "api.mydomain.com",
    "target": "https://api.internal-server.local:8080",
    "inject_headers": {
      "X-GoProx-Gateway": "true",
      "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
    }
  },
  {
    "host": "scraping.mydomain.com",
    "target": "https://target-website-to-scrape.com",
    "inject_headers": {
      "Authorization": "Bearer secret-token-here"
    }
  }
]

Note: Only the domains listed under "host" will be allowed to request Auto-SSL certificates.

🚀 Usage

Since GoProx binds directly to port 80 (for ACME challenges and HTTP to HTTPS redirection) and port 443 (for HTTPS proxying), you must run it with elevated privileges (root/sudo).

sudo ./goprox

Running as a Systemd Service (Linux)

To keep GoProx running in the background persistently, you can create a standard systemd service file:

  1. Create /etc/systemd/system/goprox.service:
[Unit]
Description=GoProx Reverse Proxy
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/path/to/goprox
ExecStart=/path/to/goprox/goprox
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
  1. Enable and start the service:
sudo systemctl daemon-reload
sudo systemctl enable goprox
sudo systemctl start goprox

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A high-performance, standalone Golang Reverse Proxy with Auto-SSL and Dynamic Header Injection. Perfect for API gateways and data scraping.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages