Print server info in served webpages


What’s the easiest way for the server to include some simple information like Caddy version, OS running on server, load time, TLS protocol used etc on the served webpages?

Does this absolutely require an installation with FastCGI and PHP?


Hmm, I’m not sure there’s currently a way to expose that information. The proper venue would be to use the templates directive but unless you have environment variables with (some of) that information, I don’t think it’s possible to show it right now. We could look into extending templates so that that becomes accessible…

EDIT: Actually I lied; you should be able to get information about the request including its TLS connection via {{.Req.TLS.Version}}, for instance. See http package - net/http - for available fields.

There was also an experiment way back when to make Caddy able to interpret Lua so you could write Lua scripts in a PHP-like workflow but without a lot of the problems of PHP. GitHub - caddyserver/caddy-lua: An experiment in executing Lua from Caddy. Ignore this for now. ;) – however, this hasn’t been developed in some time… which is a shame. I think this would be really cool.

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