trafficserver-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lei Sun <lei....@gmail.com>
Subject Re: Help needed to get ts_lua working
Date Mon, 30 Nov 2020 05:09:21 GMT
Here is my records.config
>
> CONFIG proxy.config.diags.debug.enabled INT 1
> CONFIG proxy.config.diags.debug.tags STRING ts_lua|http|dns
>

Here is the curl request

> $ curl --proxy http://127.0.0.1:8080 http://httpbin.org/get?answer=43 -v
> *   Trying 127.0.0.1...
> * TCP_NODELAY set
> * Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> > GET http://httpbin.org/get?answer=43 HTTP/1.1
> > Host: httpbin.org
> > User-Agent: curl/7.54.0
> > Accept: */*
> > Proxy-Connection: Keep-Alive
> >
> < HTTP/1.1 200 OK
> < Date: Mon, 30 Nov 2020 04:56:00 GMT
> < Content-Type: application/json
> < Content-Length: 328
> < Server: ATS/10.0.0
> < Access-Control-Allow-Origin: *
> < Access-Control-Allow-Credentials: true
> < Age: 0
> < Proxy-Connection: keep-alive
> <
> {
>   "args": {
>     "answer": "43"
>   },
>   "headers": {
>     "Accept": "*/*",
>     "Client-Ip": "127.0.0.1",
>     "Host": "httpbin.org",
>     "User-Agent": "curl/7.54.0",
>     "X-Amzn-Trace-Id": "Root=1-5fc47b60-0a4141d40331f1945a40e11c"
>   },
>   "origin": "127.0.0.1, 24.28.105.173",
>   "url": "http://httpbin.org/get?answer=43"
> }


I am using ATS/10.0.0, on Mac

Log didn't show up on any of the in traffic.out / diags.log

I used global plugin for LUA in plugin.config

> tslua.so /Users/leisun/dev/ats/test_server_request.lua




On Sun, Nov 29, 2020 at 10:50 PM Lei Sun <lei.sun@gmail.com> wrote:

> Hi Guys,
>
> I'm trying to setup ATS with LUA. I started the server no problem, and
> didn't see any issues loading the LUA plugin.
>
> leisun@/usr/local/etc/trafficserver$ sudo traffic_server -T"ts_lua"
>> Traffic Server 10.0.0 Nov 29 2020 15:56:51 Leis-MacBook-Pro.local
>> traffic_server: using root directory '/usr/local'
>> [Nov 29 22:43:54.442]  DIAG: (ts_lua) [create_lua_vms] registered config
>> string proxy.config.plugin.lua.max_states: with default [256]
>> [Nov 29 22:43:54.443]  DIAG: (ts_lua) [create_lua_vms] found
>> proxy.config.plugin.lua.max_states: [256]
>>
>
> However, as I was curling the server, and the ATS seems to be doing it's
> proxy job fine, but I cannot see any logs coming out of the following LUA
> script.
>
>> function send_request()
>> local uri = ts.server_request.get_uri()
>> ts.debug(uri)
>> ts.note('send_request')
>> ts.error('send_request')
>> ts.warning('send_request')
>> end
>>
>> function do_remap()
>> ts.note('do_remap')
>> ts.error('do_remap')
>> ts.warning('do_remap')
>> ts.hook(TS_LUA_HOOK_SEND_REQUEST_HDR, send_request)
>> return 0
>> end
>>
>
> I spent 2 full days searching online, and didn't get much luck.
>
> Could someone please let me know what I missed?
>
> PS - how do I get invited to the Slack channel please?
>
> Thank you so much!
> Lei
>
>

Mime
View raw message