trafficserver icon indicating copy to clipboard operation
trafficserver copied to clipboard

txn_box plugin error in example

Open anonymous-bugs opened this issue 5 months ago • 3 comments

Does this txn_box example work?

txn_box:

  • when: upstream-rsp do:
    • with: [ upstream-rsp-status , proxy-req-path ] select:
      • as-tuple:
        • eq: 404
        • match: "example" do:
        • debug: "Resetting upstream response"
        • upstream-rsp-status: [ 200 , "OK" ]
        • upstream-rsp-field<Cache-Control>: "max-age=3600"

Error: While parsing as-tuple comparison at Line 5. While loading "with" directive at Line 3 in "select" at Line 5. While parsing directive at Line 3. While loading directives at Line 3.

When i also use

  • with: upstream-rsp-status select:
    • eq: 200

It gives error.

anonymous-bugs avatar Jul 08 '25 11:07 anonymous-bugs

@cmcfarlen @brbzull0 can you look into this?. Im using trafficserver 10.2.0

anonymous-bugs avatar Jul 08 '25 11:07 anonymous-bugs

I'm not really familiar with txn_box syntax, but think in header_rewrite that would be like

cond %{READ_RESPONSE_HDR_HOOK} [AND]
    cond %{STATUS} =404
    set-header @newstatus "Resetting upstream response"
    set-status 200

mlibbey avatar Jul 08 '25 18:07 mlibbey

@mlibbey Thanks for your response. I'm looking to build more complex examples, so was testing provided examples since my logic kept running into error. I dont know if etags can be compared during header_rewrite

anonymous-bugs avatar Jul 09 '25 02:07 anonymous-bugs