I love nginx and while I use Caddy on my laptop all my servers are nginx.
Now the dynamic configuration API is going open this will give Envoy a good run for its money. The big thing Envoy doesn’t do is static file serving and for smaller (anything but the largest…) deployments Nginx makes a ton more sense.
What's keeping you from using Caddy in production? We designed it for that too :D
PS. Have you seen Caddy's on-line config API? https://caddyserver.com/docs/api
Is there a Caddy equivalent to OpenResty? I use openresty as a proxy for a Python app and it's been super handy to have the lua extensibility.
Caddy is designed around pluggability, everything is a module. It's written in Go, so you write your middleware logic in Go. See https://caddyserver.com/docs/extending-caddy
Interesting way of saying "no"
Maybe you can better explain what they're asking for. Because otherwise, I find it unclear. Isn't the point of OpenResty to provide a system for building your app right inside the webserver? Because you can absolutely do that with Caddy, by writing plugins.
log_format main '$remote_addr - - [$time_local] "$request" '
'$status $body_bytes_sent "$host" '
'"$http_user_agent" $http_content_length $request_time '
'"$resp_body" *$connection $connection_requests';
server {
set $resp_body "";
location ~ "^/api/v1/...$" {
# Append response to resp_body until it reaches max_len.
# - ngx.arg[1] is input chunk.
# - ngx.arg[2] is eof flag (response is done).
# - ngx.ctx.resp_body holds partial result between calls
# - ngx.var.resp_body holds final result.
# From:
# - https://gist.github.com/morhekil/1ff0e902ed4de2adcb7a
# - https://github.com/openresty/lua-nginx-module/
body_filter_by_lua_block {
local max_len = 256
local resp_body = (ngx.ctx.resp_body or "")
if string.len(resp_body) <= max_len then
resp_body = resp_body .. string.sub(ngx.arg[1], 1, max_len)
ngx.ctx.resp_body = string.sub(resp_body, 1, max_len)
end
if ngx.arg[2] then
ngx.var.resp_body = ngx.ctx.resp_body
end
}
}
But there are many scenarios where being able to extend the HTTP server via Lua is more convenient than writing a plugin I would think?I've also used Lua in the past with haproxy and with Redis. It's a powerful, performant, light-weight, and flexible escape hatch/extension mechanism.