Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/maksim-paskal/developer-proxy


https://github.com/maksim-paskal/developer-proxy

Last synced: 5 days ago
JSON representation

Awesome Lists containing this project

README

        

# Proxy local requests to cluster

## MacOS
```bash
brew install maksim-paskal/tap/developer-proxy

developer-proxy \
-endpoint="https://github.com" \
-rule="/graphql@http://127.0.0.1:4001" \
-rule="equal:/css/main.css@endpoint" \
-rule="regexp:^/(css|scripts)@http://127.0.0.1:4003" \
-rule="prefix:/payment@http://127.0.0.1:4004"
```

## Linux
```bash
docker pull paskalmaksim/developer-proxy:latest

docker run --rm -it --net=host paskalmaksim/developer-proxy:latest \
-endpoint="https://github.com" \
-rule="/graphql@http://127.0.0.1:4001" \
-rule="equal:/css/main.css@endpoint" \
-rule="regexp:^/(css|scripts)@http://127.0.0.1:4003" \
-rule="prefix:/payment@http://127.0.0.1:4004"
```

proxy will start

## Proxy routing results

```bash
# if no rules match
http://127.0.0.1:10000 => https://github.com

# -rule="/graphql@http://127.0.0.1:4001"
http://127.0.0.1:10000/graphql => http://127.0.0.1:4001

# -rule="equal:/css/main.css@endpoint"
http://127.0.0.1:10000/css/main.css => https://github.com/css/main.css

# -rule="regexp:^/(css|scripts)@http://127.0.0.1:4003"
http://127.0.0.1:10000/css/test.css => http://127.0.0.1:4003/css/test.css

# -rule="prefix:/payment@http://127.0.0.1:4004"
http://127.0.0.1:10000/payment/form => http://127.0.0.1:4004/payment/form
```

## Local development

```bash
go run ./cmd \
-endpoint="https://github.com" \
-rule="/graphql@http://127.0.0.1:4001" \
-rule="equal:/css/main.css@endpoint" \
-rule="regexp:^/(css|scripts)@http://127.0.0.1:4003" \
-rule="prefix:/payment@http://127.0.0.1:4004"
```