shukitchan commented on issue #12064:
URL: 
https://github.com/apache/trafficserver/issues/12064#issuecomment-2719180556

   The `do_global_*` functions are to be used when using Lua in plugin.config. 
   For remap plugins, it would look like this instead. 
   
   ```
   function send_request()
   ts.server_request.header["Host"] = "trafficserverurl"
   local file = io.open("/var/log/trafficserver/lua_output2.log", "a")
   file:write("Lua script is changing the host header of outgoing request.\n")
   file:close()
   end
   
   function do_remap()
   ts.hook(TS_LUA_HOOK_SEND_REQUEST_HDR, send_request)  
   local file = io.open("/var/log/trafficserver/lua_output2.log", "a")
   file:write("Lua script is running.\n")
   file:close()
   return 0
   end
   
   ```
   
   Please see example here as well - 
https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/lua.en.html#ts-server-request-get-uri


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to