https://github.com/mdouchement/switchman
A simple proxy pass for developers
https://github.com/mdouchement/switchman
development golang proxy-server
Last synced: about 1 year ago
JSON representation
A simple proxy pass for developers
- Host: GitHub
- URL: https://github.com/mdouchement/switchman
- Owner: mdouchement
- License: mit
- Archived: true
- Created: 2017-10-09T14:52:09.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-09T14:54:07.000Z (over 8 years ago)
- Last Synced: 2025-02-24T17:17:13.121Z (over 1 year ago)
- Topics: development, golang, proxy-server
- Language: Go
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Switchman - A simple proxy pass for developers
Switchman is currently an easy to use proxy pass for development environments.
It forwards requests from the `listen` interface to the destination server and allow to `rewrite` the routes.
## Installation
```sh
go get -u github.com/mdouchement/switchman
```
## Requirements
- Golang 1.7 and above
## Usage
```sh
switchman -c my_switchman.yml
```
## Configuration file
```yaml
listen: localhost:4242
rules:
"/files/*":
name: Minio
type: proxy
url: http://localhost:9000
"/api/*":
name: MyAPI
type: proxy
url: http://localhost:3000
rewrite:
from: "/api(?P.*)"
to: ""
"/*":
name: MyFrontendAssets
type: proxy
url: http://localhost:8000
```
The key of a rule is the matching pattern of all requests path.
The rewrite `from` field use the Golang Regexp named groups functionality that you can combine as you want in the `to` field.
You can write more complicated example as:
```yaml
rewrite:
from: "/api(?P[^\?]*)\?(?P.*)"
to: "/new?"
# in: /api/datasets?toto=trololo
# out: /datasets/new?toto=trololo
```
## License
**MIT**
## Contributing
1. Fork it
2. Create your feature branch (git checkout -b my-new-feature)
3. Commit your changes (git commit -am 'Add some feature')
5. Push to the branch (git push origin my-new-feature)
6. Create new Pull Request