Recipe for front-end http proxy that "finds" back-end servers that need proxying via chef-search

I will be setting up two front-end http proxies that expose 30+ back-end
servers. I would really like to do something like the following

recipe for front-end server

backends = search(:node, “proxy_me”)

backends.each do |b|
http_proxy b.name do
port b.port
protocol b.protocol
vhost b.vhost
end
end

Has anyone done something like that with either nginx or apache?