Skip to content

Latest commit

 

History

History
51 lines (41 loc) · 856 Bytes

File metadata and controls

51 lines (41 loc) · 856 Bytes
title Caddy
toc false
breadcrumbs false

Language: Go · View source on GitHub

Dockerfile

FROM caddy:2
COPY src/Servers/CaddyServer/Caddyfile /etc/caddy/Caddyfile
COPY src/Servers/CaddyServer/echo.html /srv/echo.html

Source — Caddyfile

:8080 {
    request_body {
        max_size 1MB
    }

    @post_root {
        method POST
        path /
    }
    handle @post_root {
        respond "{http.request.body}" 200
    }

    handle /echo {
        root * /srv
        templates {
            mime text/plain
        }
        rewrite * /echo.html
        file_server
    }

    respond "OK" 200
}

Source — echo.html

{{range $key, $vals := .Req.Header}}{{range $vals}}{{$key}}: {{.}}
{{end}}{{end}}