This is a reverse proxy server implementation to detect attack vectors while proxying http traffic to the downstream services.
- Reverse proxy implementation in Go
- Request and response inspection
- Attack detection
- Brute force
- SQL injection
- File inclusion
2:23AM WRN SQL injection attack detected Addr=192.168.65.1 Description="logical expression pattern" Pattern="or 1=1"
2:23AM WRN SQL injection attack detected Addr=192.168.65.1 Description="comment pattern" Pattern=--
2:23AM WRN File inclusion attack detected Addr=192.168.65.1 Reason="traversal path"
2:23AM WRN File inclusion attack detected Addr=192.168.65.1 Reason="forbidden path"
2:24AM WRN Bruteforce attack detected Addr=192.168.65.1 Reason="high ip-token count"Main application directory for the http reverse proxy server.
This directory has the core implementation for attack detectors.
This directory includes the core implementation of the reverse proxy. This is where various detectors are used while proxying traffic.
Util implements the common utility libraries that are shared by different implementations in this package.
Implements the configuration layer for the application. This is where we define the bootstrapper, logger, etc.
- Go
>= 1.25 - Docker (optional)
Clone the repository:
git clone https://github.com/mekutr/http-reverse-proxy.git
cd http-reverse-proxyConfigure environment variables:
PROXY_PORT=9090 # This is the port where the reverse proxy listens to the incoming traffic.
PROXY_TARGET_URL=http://localhost:9191 # Target URL to proxy the incoming traffic.
ENABLE_PRETTY_LOGGING=true # Pretty logs makes it more readable while testing locally.Build and run the project:
go build -o hsp ./cmd/server/main.go
./hspClone the repository:
git clone https://github.com/mekutr/http-reverse-proxy.git
cd http-reverse-proxyConfigure environment variables: Edit the following environment variables in the Dockerfile if you would like to
# Environment variables
ENV PROXY_PORT=9090 \
PROXY_TARGET_URL=http://host.docker.internal:9191 \
ENABLE_PRETTY_LOGGING=trueBuild and run the project:
docker build -t http-secure-proxy:1.0 . # builds the docker image
docker run --name hsp -d -it -p 9090:9090 http-secure-proxy:1.0 # Enables interactive terminal in detached mode
docker logs -f hsp # read logs from the interactive terminal