[ForwardProxy] How to review the request info in Caddy log


I wanted to know the client’s request info like Remote Host, URI when I use Caddy as the Forward Proxy.

For example, curl https://caddyserver.com/docs/tls -x http://localhost:8080. I want to see the Remote Host is caddyserver.com, the method and URI are GET /docs/tls.

The normal logging will only log the Proxy Request which will show the Remote Host is the Caddy Server itself (localhost ::1 in this case)

::1 - - [27/Feb/2019:15:03:34 +0800] "CONNECT / HTTP/1.1" 200 0 "-" "curl/7.54.0"

I tried to use this config

log / stdout "{combined}" 
# Enable forwardproxy
forwardproxy {
    log / stdout "{combined}"

I’ve got the error

2019/02/27 15:00:35 Caddyfile:5 - Error during parsing: Wrong argument count or unexpected line ending after '{combined}'

Hi @chrisduong, welcome to the Caddy community.

It looks like you’re trying to repeat the log directive inside the forwardproxy directive, but directives can’t be stacked in this manner.

This functionality needs to come from forwardproxy itself, which is non-core middleware maintained separately from the Caddy project itself.

You can browse their documentation and open a feature request over at the git repository:

GitHub - caddyserver/forwardproxy: Forward proxy plugin for the Caddy web server

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.