Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sentriz/log-proxy
a reverse proxy to a single address, logging request and response bodies
https://github.com/sentriz/log-proxy
Last synced: 19 days ago
JSON representation
a reverse proxy to a single address, logging request and response bodies
- Host: GitHub
- URL: https://github.com/sentriz/log-proxy
- Owner: sentriz
- Created: 2020-04-27T16:00:44.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-10-18T15:18:07.000Z (over 2 years ago)
- Last Synced: 2024-12-11T22:05:37.141Z (about 1 month ago)
- Language: Go
- Homepage:
- Size: 8.79 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
### log-proxy
a reverse proxy to a single address, logging request and response bodies
###### installation
`$ go install go.senan.xyz/log-proxy@latest`
###### usage
```
-listen-addr string
address to listen on, eg. :5050
-to string
address to proxy to, eg. http://localhost:4040
```eg. say I have a service running on my laptop on port 4040. it doesn't log requests and the usual client doesn't log anything
`$ log-proxy -listen-addr :5050 -to http://localhost:4040`
now point the client at 5050 instead, and see the requests and responses in sequence
```
2020/04/27 17:23:02 listening on ":5050"######### (1) request #########
GET /rest/ping.view?u=admin&p=admin&c=c&v=1.15 HTTP/1.1
Host: localhost:4040
Accept: */*
User-Agent: curl/7.69.1
X-Forwarded-For: ::1
X-Forwarded-Host:######### (1) response #########
HTTP/1.1 200
Content-Length: 125
Access-Control-Allow-Origin: *
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Content-Type: text/xml;charset=UTF-8
Date: Mon, 27 Apr 2020 16:23:08 GMT
Expires: 0
Pragma: no-cache
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 1; mode=block######### (2) request #########
GET /rest/getIndexes.view?u=admin&p=admin&c=c&v=1.15 HTTP/1.1
Host: localhost:4040
Accept: */*
User-Agent: curl/7.69.1
X-Forwarded-For: ::1
X-Forwarded-Host:######### (2) response #########
HTTP/1.1 200
Content-Length: 328
Access-Control-Allow-Origin: *
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Content-Type: text/xml;charset=UTF-8
Date: Mon, 27 Apr 2020 16:23:12 GMT
Expires: 0
Pragma: no-cache
Set-Cookie: player-61646d696e=2; Max-Age=31536000; Expires=Tue, 27-Apr-2021 16:23:12 GMT; Path=/; HttpOnly
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 1; mode=block
######### (3) request #########
GET /rest/ping.view?u=admin&p=admin&c=c&v=1.15 HTTP/1.1
Host: localhost:4040
Accept: */*
User-Agent: curl/7.69.1
X-Forwarded-For: ::1
X-Forwarded-Host:######### (3) response #########
HTTP/1.1 200
Content-Length: 125
Access-Control-Allow-Origin: *
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Content-Type: text/xml;charset=UTF-8
Date: Mon, 27 Apr 2020 16:23:15 GMT
Expires: 0
Pragma: no-cache
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 1; mode=blocksignal: interrupt
```