This repository contains a simple implementation of a reverse proxy server in Golang. The proxy server is configured using a YAML file, it can route different backend servers based on the specified endpoints.
The proxy server is implemented using Golang and leverages the net/http package. It provides a flexible way to route incoming requests to differenet backend servers based on the configurations specified in a YAML file.
To use the reverse proxy server, follow the steps outlined below:
- Clone the repository to your local machine.
- Configure the proxy server using the
config.yamlfile. - Run the proxy server using the provided Golang code.
The configuration file (config.yaml) is used to define the server settings and resources (backend servers) to which requests should be proxied. Below is an example configuration:
server:
host: "localhost:
listen_port: "8080"
resources:
- name: Server1
endpoint: /server1
destination_url: "http://localhost:9001"
- name: Server2
endpoint: /server2
destination_url: "http://localhost:9002"
- name: Server3
enpoint: /server3
destination_url: "http://localhost:9003"To run the proxy server, execute the go run command
go run main.go