MiniHttpReMux an HTTP proxy server allowing modify headers and forward requests.
573
MiniHttpReMux is an HTTP proxy server written in Go that allows you to listen on multiple ports, modify HTTP headers, and forward requests to specified target servers. This project is designed to be easily configurable via a YAML file and can be deployed using Docker.
MiniHttpReMux
├── main.go # Entry point of the application
├── internal
│ └── handlers
│ └── proxy.go # Proxy logic and configuration
├── config
│ └── config.yaml # Configuration file for the proxy
├── Dockerfile # Dockerfile for building the image
├── go.mod # Module definition and dependencies
├── go.sum # Dependency checksums
└── README.md # Project documentation
Clone the repository:
git clone https://github.com/dotnetautor/MiniHttpReMux.git
cd MiniHttpReMux
Build the project:
go build -o minihttremux
Run the application:
./minihttremux
Run with config file:
./minihttremux -config config/config.user.yaml
The proxy default configuration is defined in the config/config.yaml file. Each port can have its own target server and header modifications. An example configuration might look like this:
ports:
- port: 8080
target: "http://example.com"
headers:
Host: "example.com"
X-Custom-Header: "value"
- port: 8081
target: "http://another-example.com"
headers:
Host: "another-example.com"
To build and run the Docker container, use the following commands:
Build the Docker image:
docker build -t minihttremux .
Run the Docker container:
docker run -p 8080:8080 -p 8081:8081 -v ./config.yaml:/app/config/config.yaml dotnetautor/mini-http-re-mux
You can also use Docker Compose to manage the container. Here is an example docker-compose.yml file:
services:
minihttremux:
image: dotnetautor/mini-http-re-mux
build: .
ports:
- "8080:8080"
- "8081:8081"
volumes:
- ./config.yaml:/app/config/config.yaml
To build and run the Docker container using Docker Compose, use the following commands:
docker-compose up --build
docker-compose down
Once the server is running, you can send HTTP requests to the configured ports, and the proxy will handle the requests according to the specified configuration.
This project is open source and available under the MIT License.
Content type
Image
Digest
sha256:8ac7b76cc…
Size
4.9 MB
Last updated
over 1 year ago
docker pull dotnetautor/mini-http-re-mux