https://github.com/agungdwiprasetyo/reverse-proxy
Repository for manage all my API's
https://github.com/agungdwiprasetyo/reverse-proxy
apigateway golang kubernetes reverse-proxy routing-engine
Last synced: 7 months ago
JSON representation
Repository for manage all my API's
- Host: GitHub
- URL: https://github.com/agungdwiprasetyo/reverse-proxy
- Owner: agungdwiprasetyo
- Created: 2019-03-12T02:43:41.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-05-19T14:46:49.000Z (over 4 years ago)
- Last Synced: 2025-01-16T20:55:29.335Z (9 months ago)
- Topics: apigateway, golang, kubernetes, reverse-proxy, routing-engine
- Language: Go
- Homepage: https://api.agungdp.dev
- Size: 21.5 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Pengendali API (Reverse proxy for API Gateway)
[](https://travis-ci.org/agungdwiprasetyo/reverse-proxy)
[](https://codecov.io/gh/agungdwiprasetyo/reverse-proxy)
[](https://golang.org/doc/devel/release.html#go1.12)[](https://codecov.io/gh/agungdwiprasetyo/reverse-proxy)
A http tool for reverse proxy like nginx **(NO Framework, just write in PURE Go)**
### Use
* Install Golang
```sh
$ brew install golang
```* Build app
```sh
$ make build
```* Copy `config.example.json` to `config.json`
```sh
$ cp config.example.json config.json
```* Add your services in `config.json`
```json
{
"services": [
{
"root": "[root for service, example: /myapp]",
"host": "[host service, example: http://localhost:8000]"
}
]
}
```* Set app port
```json
{
"gateway_port": 3000,
}
```* Run binary
```sh
$ ./bin
[GATEWAY] :3000/myapp/ |===> http://localhost:8000
Server running on port :3000
```In nginx, configuration for adding proxy like this:
```
location /myapp/ {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
}
```In this app, for adding a proxy just add in `config.json`