Hello,
You will not be able to use the "IncomingHttpRequestFilter" Lua for this purpose, as this function has no primitive to answer with a HTML body.
For the time being, the only way to dynamically generate a HTTP answer from within Orthanc is by creating a dedicated C/C++ plugin.
You could create a C/C++ plugin that would provide a wrapper to Lua. Concretely, this plugin would run an embedded Lua engine (e.g. by reusing the "Core/Lua/LuaContext.h" class from the Orthanc core), and would use the traditional "OrthancPluginRegisterRestCallback()" to branch this Lua engine behind some URI endpoint of the REST API of Orthanc.
If other users show interest in this feature, I might consider it for addition inside the official sample plugin ServeFolders.
External contributors are also kindly invited to implement such a plugin.
Regards,
Sébastien-