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

   ```
   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 to 
origin.\n")
   file:close()
   end
   
   function send_response()
     local jsa = ts.client_response.header['x-jsa-authorization-redirect']
     string.gsub(jsa, 'ihsurl', 'trafficserverfqdn')
     ts.client_response.header['x-jsa-authorization-redirect'] = jsa
   local file = io.open("/var/log/trafficserver/lua_output2.log", "a")
   file:write("Lua script is changing the jsa header of outgoing response to 
client.\n")
   file:close()
   end
   
   function do_remap()
   ts.hook(TS_LUA_HOOK_SEND_REQUEST_HDR, send_request)  
   ts.hook(TS_LUA_HOOK_SEND_RESPONSE_HDR, send_response)
   local file = io.open("/var/log/trafficserver/lua_output2.log", "a")
   file:write("Lua script is running.\n")
   file:close()
   return 0
   end
   ```
   
   Let's just forcefully change the jsa response header. Please also don't do 
logging this way in production. The performance will be bad. 


-- 
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