Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
458 views
in Technique[技术] by (71.8m points)

big ip - How to identify the pool member that processed an HTTP_REQUEST in an iRule

To help with diagnosing a production issue, I'd like to insert the name of the pool member that handled the HTTP_RESPONSE.

I have a pool (my_application_pool) configured with three members (WEB1, WEB2, WEB3), like this:

  • Pool: my_application_pool
    • Pool Member: WEB1
    • Pool Member: WEB2
    • Pool Member: WEB3

I have an iRule that looks like this:

when HTTP_REQUEST {
      pool my_application_pool
}

when HTTP_RESPONSE {
      HTTP::header insert pool_member_name value_1
}

If it is WEB2 that processed a request, how can I replace "value_1" with "WEB2"

Thanks!

question from:https://stackoverflow.com/questions/65940717/how-to-identify-the-pool-member-that-processed-an-http-request-in-an-irule

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can add this to your irule above to populate value_1:

when LB_SELECTED {
  set value_1 [LB::server addr]
}

If you are using multiple ports with same addr and/or route domains, you can expand that to be:

set value_1 "[LB::server addr]%[LB::server route_domain]:[LB::server port]"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...