Skip to content

Fix - Caddy - Not echoing body content on POST / requests #51

Description

@MDA2AV

implementation - https://github.com/MDA2AV/Http11Probe/tree/main/src/Servers/CaddyServer

Must echo the body content on
Method: POST
Route: /

Activity

  1. changed the title [-]Fix - Caddy - Not echoing body content on POST requests[/-] [+]Fix - Caddy - Not echoing body content on POST / requests[/+] on Feb 14, 2026
  2. mohammed90 commented on Feb 14, 2026

    @mohammed90

    This Caddyfile (Caddy config) prints the body:

    example.com {
    	respond "{http.request.body}"
    }
  3. mohammed90 commented on Feb 14, 2026

    @mohammed90

    Ignore my previous reply. See this:

    example.com {
    	
    	request_body {
    		max_size 1MB
    	}
    
    	templates
    
    	respond <<PARROT
    		## Request Summary:
    		Method         : {{ .Req.Method }}
    		URI            : {{ .Req.RequestURI }}
    		Protocol       : {{ .Req.Proto }}
    		Remote Address : {{ .Req.RemoteAddr }}
    		Server         : {{ .Req.Host }}
    		Connection     : {{ if .Req.TLS }}HTTPS{{ else }}HTTP{{ end }}
    		Timestamp      : {{ now | date "2006-01-02 15:04:05 UTC" }}
    		
    		{{ if .Req.TLS -}}
    		## TLS Details:
    		Version        : {tls_version}
    		Cipher Suite   : {tls_cipher}
    		Protocol       : {{ .Req.TLS.NegotiatedProtocol }}
    		SNI            : {{ .Req.TLS.ServerName }}
    		{{- end }}
    
    		## Headers:
    		{{ if .Req.Host }}Host: {{ .Req.Host }}{{ end }}
    		{{ range $header, $values := .Req.Header }}{{ range $values }}{{ printf "%s: %s\n" $header . }}{{ end }}{{ end -}}
    		
    		{{ if .Req.URL.RawQuery }}
    		## Query Parameters:
    		{{ range $param, $values := .Req.URL.Query }}{{ range $values}}{{printf "%s: %s\n" $param . }}{{ end }}{{ end -}}
    		{{ end -}}
    		
    		{{ if or (eq .Req.Method "POST") (eq .Req.Method "PUT") (eq .Req.Method "PATCH") }}
    		## Request Body:
    		{{ placeholder "http.request.body" }}
    		{{ end }}
    		PARROT
    }

    Source: https://caddy.community/t/caddy-parrot-a-simple-http-echo-service/33089

  4. self-assigned this
    on Feb 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions