Skip to content

Commit 1653904

Browse files
author
Dominick Brasileiro
committed
docs: add README.md
1 parent a553b70 commit 1653904

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed

README.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# go-reverse-proxy
2+
"go-reverse-proxy" is a command line tool that creates a reverse proxy between your host and a origin.
3+
You can use it to forward incoming requests to a server in another URL, for example.
4+
5+
## Usage
6+
```
7+
Usage:
8+
go-reverse-proxy [flags]
9+
10+
Flags:
11+
-h, --help help for go-reverse-proxy
12+
-H, --host string Host to listen to (default "0.0.0.0")
13+
-o, --origin string Origin server URL
14+
-p, --port string Port to listen to (default "8080")
15+
```
16+
17+
### Example
18+
Redirects http requests from `http://127.0.0.1:5000` -> `https://google.com`.
19+
```sh
20+
$ go-reverse-proxy --origin=https://google.com --host=127.0.0.1 --port=5000
21+
```
22+
23+
## Installation
24+
### Docker and Docker Compose
25+
The "go-reverse-proxy" docker image is available upon [ghcr.io](https://github.com/dominickbrasileiro/go-reverse-proxy/pkgs/container/go-reverse-proxy) registry.
26+
You can pull it running the command below:
27+
```sh
28+
$ docker pull ghcr.io/dominickbrasileiro/go-reverse-proxy
29+
```
30+
31+
If you want to pull a specific version of "go-reverse-proxy", use a tag:
32+
```sh
33+
$ docker pull ghcr.io/dominickbrasileiro/go-reverse-proxy:1.1.0
34+
```
35+
36+
To run the "go-reverse-proxy" image, you'll need to provide the following environment variables:
37+
- HOST
38+
- ORIGIN
39+
- PORT
40+
41+
Example using `docker run` command:
42+
```sh
43+
$ docker run \
44+
-e HOST=127.0.0.1 \
45+
-e ORIGIN=https://google.com \
46+
-e PORT=5000 \
47+
--name go-reverse-proxy ghcr.io/dominickbrasileiro/go-reverse-proxy
48+
```
49+
50+
Example using `docker-compose.yml`:
51+
```yml
52+
version: "3.8"
53+
services:
54+
go-reverse-proxy:
55+
container_name: "go-reverse-proxy"
56+
image: "ghcr.io/dominickbrasileiro/go-reverse-proxy"
57+
restart: "always"
58+
environment:
59+
- "HOST=127.0.0.1"
60+
- "ORIGIN=https://google.com"
61+
- "PORT=5000"
62+
```
63+
64+
### Building from source
65+
#### Requirements
66+
- [Go](https://go.dev/) (1.20 or later)
67+
68+
1. Using make and Makefile
69+
```sh
70+
$ git clone https://github.com/dominickbrasileiro/go-reverse-proxy.git
71+
$ cd go-reverse-proxy
72+
$ make build
73+
```
74+
75+
2. Without Makefile
76+
```sh
77+
$ git clone https://github.com/dominickbrasileiro/go-reverse-proxy.git
78+
$ cd go-reverse-proxy
79+
$ go get -v ./...
80+
$ go build -o ./bin/go-reverse-proxy .
81+
```
82+
83+
Now you have the "go-reverse-proxy" binary in `./bin/go-reverse-proxy`. If you want to use it globally, run the command below:
84+
```sh
85+
$ sudo mv ./bin/go-reverse-proxy /usr/local/bin
86+
```
87+
88+
---
89+
90+
Made with ❤️ by Dominick Brasileiro.
91+
92+
Feel free [to reach out](https://www.linkedin.com/in/dominickbrasileiro/)!
93+
94+
[![Linkedin Badge](https://img.shields.io/badge/-LinkedIn-blue?style=flat-square&logo=Linkedin&logoColor=white&link=https://www.linkedin.com/in/dominickbrasileiro/)](https://www.linkedin.com/in/dominickbrasileiro/)

0 commit comments

Comments
 (0)