Error: unrecognized directive: <html>

1. The problem I’m having:

I want to serve a simple HTML page in response to an http request. I used the example provided in the docs

2. Error messages and/or full log output:

Jul 06 21:34:30 ==> Starting Caddy
Jul 06 21:34:30 2025/07/07 04:34:30.468 INFO using provided configuration {"config_file": "/etc/caddy/Caddyfile", "config_adapter": ""}
Jul 06 21:34:30 Error: adapting config using caddyfile: /etc/caddy/Caddyfile:6: unrecognized directive: <html>
Jul 06 21:34:30 Error: caddy process exited with error: exit status 1

3. Caddy version:

2.6.2

4. How I installed and ran Caddy:

apt-get install -y --no-install-recommends caddy

a. System environment:

It’s a docker image based on Cloudron’s app base image. I believe it’s Ubuntu based.

b. Command:

/usr/local/bin/gosu cloudron:cloudron /app/code/bin/agate --content /app/data/public/ --certs /app/data/certs/ --addr 0.0.0.0:1965 --hostname ${CLOUDRON_APP_DOMAIN} --lang en-US

c. Service/unit/compose file:

Not sure what that is in my case.

d. My complete Caddy config:

http:// {
	# -- The purpose of Caddy here is to respond to Cloudron's health check on port 80
	# -- and display an information message for HTTP browsers.
	header Content-Type text/html
	respond <<HTML
		<html>
			<head><title>Foo</title></head>
			<body>Foo</body>
		</html>
		HTML 200
}

The version is too old. The latest is 2.10.0. Use our apt repository to get the latest version.

2 Likes

Thank you! That did the trick.

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