Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
501 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 Answer

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...