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.
- 🚀 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, injectAuthorizationtokens, 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.
Ensure you have Go 1.21+ installed on your machine.
-
Clone the repository:
git clone https://github.com/yourusername/goprox.git cd goprox -
Build the binary:
go build -o goprox
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.
[
{
"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.
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 ./goproxTo keep GoProx running in the background persistently, you can create a standard systemd service file:
- 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- Enable and start the service:
sudo systemctl daemon-reload
sudo systemctl enable goprox
sudo systemctl start goproxThis project is licensed under the MIT License - see the LICENSE file for details.