Skip to content

Commit

Permalink
Caddy update 1.5 (#806)
Browse files Browse the repository at this point in the history
* vvip

* vvip

* Caddy vvip

* fix parser assert

* fix parser assert

* revert debug for dateparse

* revert debug for dateparse

* Caddy has normalised it logs to client_ip so we must do the same

* Add better caddy tests

* Fix tests
  • Loading branch information
LaurenceJJones authored Dec 12, 2023
1 parent a18bf76 commit 1c85286
Show file tree
Hide file tree
Showing 3 changed files with 750 additions and 193 deletions.
11 changes: 7 additions & 4 deletions .tests/caddy-logs/caddy-logs.log
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{"level":"error","ts":1629470295.021685,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_addr":"4.3.2.1:56466","proto":"HTTP/1.1","method":"GET","host":"1.2.3.4","uri":"/","headers":{"User-Agent":["curl/7.68.0"],"Accept":["*/*"]}},"common_log":"4.3.2.1 - - [20/Aug/2021:14:38:15 +0000] \"GET / HTTP/1.1\" 401 0","duration":1.454630671,"size":0,"status":401,"resp_headers":{"Server":["Caddy"],"Www-Authenticate":["Basic realm=\"restricted\""]}}
{"level":"error","ts":1649314776.603171,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"127.0.0.1","remote_port":"28728","proto":"HTTP/2.0","method":"POST","host":"www.bmunro.xyz","uri":"/client","headers":{"X-Forwarded-For":["1.2.3.4"],"Cf-Ray":["6f80e1a9bf8f3ea5-CPT"],"Content-Length":["27"],"Origin":["127.0.0.1"],"Cdn-Loop":["cloudflare"],"Accept-Encoding":["gzip"],"Accept":["application/json, text/plain, */*"],"Authorization":[],"Sec-Ch-Ua-Platform":["\"Windows\""],"Sec-Fetch-Mode":["cors"],"Referer":["127.0.0.1/"],"Cf-Ipcountry":["ZA"],"Cf-Visitor":["{\"scheme\":\"https\"}"],"Sec-Ch-Ua":["\"Chromium\";v=\"98\", \" Not A;Brand\";v=\"99\""],"Content-Type":["application/json"],"Sec-Fetch-Dest":["empty"],"Cf-Connecting-Ip":["1.2.3.4"],"X-Forwarded-Proto":["https"],"Sec-Fetch-Site":["same-origin"],"Accept-Language":["en-GB,en-ZA;q=0.9,en-US;q=0.8,en;q=0.7"],"Cookie":[],"Sec-Ch-Ua-Mobile":["?0"],"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.141 Safari/537.36"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"www.bmunro.xyz"}},"user_id":"","duration":0.000989896,"size":141,"status":401,"resp_headers":{"Server":["Caddy"],"Content-Type":["application/json"],"Date":["Thu, 07 Apr 2022 06:59:36 GMT"],"Content-Length":["141"]}}
{"level":"info","ts":1672221106.8667448,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"172.17.0.1","remote_port":"44746","proto":"HTTP/1.1","method":"GET","host":"localhost","uri":"/?test=123","headers":{"User-Agent":["curl/7.82.0"],"Accept":["*/*"]}},"user_id":"","duration":0.000114941,"size":12226,"status":200,"resp_headers":{"Server":["Caddy"],"Etag":["\"rjd8q99fm\""],"Content-Type":["text/html; charset=utf-8"],"Last-Modified":["Fri, 07 Oct 2022 04:34:57 GMT"],"Accept-Ranges":["bytes"],"Content-Length":["12226"]}}
{"level":"info","ts":1672221134.5412338,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"172.17.0.1","remote_port":"44256","proto":"HTTP/1.1","method":"GET","host":"localhost","uri":"/?test=123&123=test","headers":{"User-Agent":["curl/7.82.0"],"Accept":["*/*"]}},"user_id":"","duration":0.000148591,"size":12226,"status":200,"resp_headers":{"Content-Length":["12226"],"Server":["Caddy"],"Etag":["\"rjd8q99fm\""],"Content-Type":["text/html; charset=utf-8"],"Last-Modified":["Fri, 07 Oct 2022 04:34:57 GMT"],"Accept-Ranges":["bytes"]}}
{"level":"info","ts":1693840791.7564995,"logger":"http.log.access","msg":"handled request","request":{"remote_ip":"172.17.0.1","remote_port":"44790","client_ip":"127.0.0.1","proto":"HTTP/1.0","method":"GET","host":"127.0.0.1:8080","uri":"/","headers":{"X-Forwarded-Port":["80"],"X-Real-Ip":["127.0.0.1"],"Forwarded":["for=127.0.0.1"],"X-Forwarded-Host":["127.0.0.1"],"User-Agent":["curl/7.74.0"],"Accept":["*/*"],"Connection":["close"],"X-Forwarded-For":["127.0.0.1"],"X-Forwarded-Proto":["http"]}},"bytes_read":0,"user_id":"","duration":0.000002701,"size":0,"status":0,"resp_headers":{"Server":["Caddy"]}}
{"level":"info","ts":1693840792.1942985,"logger":"http.log.access","msg":"handled request","request":{"remote_ip":"172.17.0.1","remote_port":"45750","client_ip":"127.0.0.1","proto":"HTTP/1.0","method":"GET","host":"127.0.0.1:8080","uri":"/","headers":{"User-Agent":["curl/7.74.0"],"Forwarded":["for=127.0.0.1"],"X-Forwarded-Proto":["http"],"X-Forwarded-For":["127.0.0.1"],"X-Forwarded-Host":["127.0.0.1"],"X-Forwarded-Port":["80"],"Accept":["*/*"],"Connection":["close"],"X-Real-Ip":["127.0.0.1"]}},"bytes_read":0,"user_id":"","duration":0.000002364,"size":0,"status":0,"resp_headers":{"Server":["Caddy"]}}
{"level":"info","ts":1693840792.5886028,"logger":"http.log.access","msg":"handled request","request":{"remote_ip":"172.17.0.1","remote_port":"45764","client_ip":"127.0.0.1","proto":"HTTP/1.0","method":"GET","host":"127.0.0.1:8080","uri":"/","headers":{"X-Forwarded-Proto":["http"],"X-Forwarded-Port":["80"],"User-Agent":["curl/7.74.0"],"Connection":["close"],"X-Real-Ip":["127.0.0.1"],"Forwarded":["for=127.0.0.1"],"X-Forwarded-For":["127.0.0.1"],"X-Forwarded-Host":["127.0.0.1"],"Accept":["*/*"]}},"bytes_read":0,"user_id":"","duration":0.000002223,"size":0,"status":0,"resp_headers":{"Server":["Caddy"]}}
{"level":"info","ts":1693840839.657635,"logger":"http.log.access","msg":"handled request","request":{"remote_ip":"172.17.0.1","remote_port":"42876","client_ip":"172.17.0.1","proto":"HTTP/1.1","method":"GET","host":"127.0.0.1:8080","uri":"/","headers":{"Accept":["*/*"],"User-Agent":["curl/7.74.0"]}},"bytes_read":0,"user_id":"","duration":0.000002689,"size":0,"status":0,"resp_headers":{"Server":["Caddy"]}}
{"level":"info","ts":1693840840.2321608,"logger":"http.log.access","msg":"handled request","request":{"remote_ip":"172.17.0.1","remote_port":"42884","client_ip":"172.17.0.1","proto":"HTTP/1.1","method":"GET","host":"127.0.0.1:8080","uri":"/","headers":{"Accept":["*/*"],"User-Agent":["curl/7.74.0"]}},"bytes_read":0,"user_id":"","duration":0.000002693,"size":0,"status":0,"resp_headers":{"Server":["Caddy"]}}
{"level":"info","ts":1693840840.5579731,"logger":"http.log.access","msg":"handled request","request":{"remote_ip":"172.17.0.1","remote_port":"42892","client_ip":"172.17.0.1","proto":"HTTP/1.1","method":"GET","host":"127.0.0.1:8080","uri":"/","headers":{"User-Agent":["curl/7.74.0"],"Accept":["*/*"]}},"bytes_read":0,"user_id":"","duration":0.000002928,"size":0,"status":0,"resp_headers":{"Server":["Caddy"]}}
{"level":"info","ts":1693840840.896227,"logger":"http.log.access","msg":"handled request","request":{"remote_ip":"172.17.0.1","remote_port":"42894","client_ip":"172.17.0.1","proto":"HTTP/1.1","method":"GET","host":"127.0.0.1:8080","uri":"/","headers":{"User-Agent":["curl/7.74.0"],"Accept":["*/*"]}},"bytes_read":0,"user_id":"","duration":0.000002716,"size":0,"status":0,"resp_headers":{"Server":["Caddy"]}}
Loading

0 comments on commit 1c85286

Please sign in to comment.