fwd-proxy is a lightweight, cross-platform HTTP Reverse Proxy written in Go. It is designed to be a simple, easy-to-deploy tool for forwarding requests to a backend server, with built-in support for CORS, custom headers, and cross-platform compatibility.
- HTTP/TCP Proxying: Forwards HTTP requests to a specified target server.
- CORS Support: Easily enable default CORS headers with a single flag.
- Custom Headers: Inject custom response headers (e.g., for testing or specific client requirements).
- Cross-Platform: Binaries available for Linux, macOS, and Windows (amd64/arm64).
- Zero Dependency: Single static binary, no dependencies required on the host.
You can install the latest release using the installation script:
curl -fsSL https://raw.githubusercontent.com/open-zhy/fwd-proxy/main/install.sh | shDownload the latest binary for your OS and Architecture from the Releases page.
Requirements: Go 1.24+
git clone https://github.com/open-zhy/fwd-proxy.git
cd fwd-proxy
make build
# Binary will be in bin/fwd-proxy./fwd-proxy -port <PORT> -target <TARGET_URL> [OPTIONS]| Flag | Description | Default |
|---|---|---|
-port |
Local port to listen on. | 8080 |
-target |
Required. The target server URL (e.g., http://localhost:9000). |
|
-cors |
Enable default CORS headers (Access-Control-Allow-Origin: *, etc.). |
false |
-header |
Custom header to add to response. Format: Key:Value. Can be used multiple times. |
|
-version |
Print version information and exit. |
Basic Forwarding: Forward traffic from localhost:8080 to localhost:3000:
./fwd-proxy -target http://localhost:3000With Custom Port: Listen on port 9090 and forward to a remote API:
./fwd-proxy -port 9090 -target https://api.example.comTesting with CORS and Custom Headers: Useful for frontend development against an API that doesn't send CORS headers:
./fwd-proxy -target http://localhost:3000 -cors -header "X-Debug: True" -header "Cache-Control: no-cache"make testmake build-allThis command generates binaries for all supported platforms in the bin/ directory.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License.