Uploaded image for project: 'Traffic Server'
  1. Traffic Server
  2. TS-4627

ts_lua plugin - support TSRemapOSResponse() related functionality

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 7.0.0
    • Lua, Plugins
    • None

    Description

      I want to add enhancement to ts_lua so I can write script to take advantage of the TSRemapOSResponse() related functionality.

      here is one such example

      function do_os_response()
          ts.debug('do_os_response')
          ts.http.enable_redirect(0)
      
          local st = ts.http.get_server_state()
          if st == TS_LUA_SRVSTATE_CONNECTION_ALIVE then
            ts.debug('alive')
            ts.http.enable_redirect(0)
          else
            ts.debug('not alive')
            ts.http.redirect_url_set('http://www.cnn.com')
            ts.hook(TS_LUA_HOOK_SEND_RESPONSE_HDR, send_response)
          end
      
      end
      
      function send_response()
          ts.debug('send_response')
      end
      

      Basically it would allow me to do something when origin server fails to connect (such as DNS error, timeout, etc)

      Attachments

        Issue Links

          Activity

            People

              kichan Shu Kit Francis Chan
              kichan Shu Kit Francis Chan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 20m
                  2h 20m