Additional http-headers with reply_html_page/2,3

I understand and use predicate “reply_html_page/2,3” to generate some html as a response to a http request.
But besides the standard http headers (Content-Type, Content-Length), how can I add additional http headers to the response? E.g. If I wanted to add an ETag to my response?
Any ideas?

Just call this before reply_html_page/2. The task of the body is very similar to CGI scripts: it must write an HTTP header that ends with an empty line and then the body. So, any header you write before calling one of the page generation predicates is simply passed along.

format('Etag: ~w~n', [Etag])

Yep, this works, although I find the solution a bit “clumsy”

format('x-header: ~w~n', [some])
, reply_html_page([title('Some title')], [h1('Some Title')]).

I agree. Eventually there should be something like http_add_header/2 that can be called anywhere during the body generation …

Agree, but looking at the code for reply_html_page/2,3, this doesn’t seem trivial to implement.
Well, at least not by me…

It must be implemented in which formulates the final reply header (if my memory is accurate). I think we could maintain a global variable or thread-local dynamic predicate to contain the extra headers and inject these into the final reply header or something along these lines.