As the title...Build an environment for the nginx+lua-nginx-module module
Access the URL /abc
and return the data of a.html
But before returning data
you need to replace <p>111</p>
in a.html
with <p>222< /p>
Can I do this with Lua?
The current attempt is to try to get the return data in body_filter_by_lua_file
ngx.arg[1]
But I can’t get it...Where should the return data be? What about acquisition and processing?
滿天的星座2017-05-16 17:14:34
It can certainly be done. This is equivalent to using Lua to perform DOM operations. I believe there must be a ready-made DOM library on the Internet. You can write one if you don’t have one yourself. Second question, I don’t know much about it
phpcn_u15822017-05-16 17:14:34
I am going to try to use lua-resty-http or ngx.location.capture to send a request, modify the returned result, and then return the data
为情所困2017-05-16 17:14:34
If you are simply doing replacement, you can use Nginx’s ngx_http_sub_module module