Work In Progress
BINARY
mode still not implemented
Write middlewares with you preferred languages!
PHP, Python, NodeJS or more - it does not matter!
The Bridge plugin allows make requests to your services.
logserver
(github) as backend for logging requests (or any you prefer software)docker run --rm -p 2000:2000 negasus/logserver
go run ./test/http
address: 'http://127.0.0.1:3000'
# in my case the Traefik is listen 8000 port
curl http://localhost:8000
logserver
output----------[ 1 ]----------
2020-09-06 17:33:29.3858593 +0000 UTC m=+172.295935301
[172.17.0.1:47380] GET /
Host: localhost:8000
Content-Length: 0
User-Agent: Middleware! <----- It's work!
Accept: */*
X-Forwarded-For: 127.0.0.1
X-Forwarded-Host: localhost:8000
X-Forwarded-Port: 8000
X-Forwarded-Proto: http
X-Forwarded-Server: notebook
X-Real-Ip: 127.0.0.1
Accept-Encoding: gzip
protocol: 'HTTP' or 'BINARY'. Default 'HTTP'
address: Address of your service. Default 'http://127.0.0.1:8000'
timeout: Request timeout to your service, ms. Default '500'
fail_strategy: Strategy on fail request to your service. Default 'PASS'
request:
- headers: bool. Send request headers to your service. Default 'true'
- remote_address: bool. Send remote address to your service. Default 'true'
- method: bool. Send http method to your service. Default 'true'
- uri: bool. Send URI method to your service. Default 'true'
type Request struct {
Headers map[string][]string `json:"1,omitempty"`
RemoteAddr string `json:"2,omitempty"`
Method string `json:"3,omitempty"`
RequestURI string `json:"4,omitempty"`
}
type Response struct {
AddRequestHeaders map[string]string `json:"1,omitempty"`
AddResponseHeaders map[string]string `json:"2,omitempty"`
DeleteRequestHeaders []string `json:"3,omitempty"`
InterruptRequest *ResponseInterruptRequest `json:"4,omitempty"`
}
type ResponseInterruptRequest struct {
ResponseCode int `json:"1,omitempty"`
Body string `json:"2,omitempty"`
}
BINARY
mode