Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 
Custom Alert Banner

Irule to use different persistence cookie by node

impala_38421
Nimbostratus
Nimbostratus

I need to create an irule that use different pools according the URL requested and insert a different persistence cookie to each pool member

I will try to explain the scenario.

The elements are:

One Virtual Server: VS1
Three Pools: Pool1, Pool2, Pool3
Two Nodes: Node1, Node2
6 persistence cookies: ck1, ck2, ck3, ck4, ck5, ck6

3 URLs that could be used by source user. VS1 has the IP of the URL, and the URL allways is the same only changes the resource

htttps://URL/XXXX    
htttps://URL/YYYY    
htttps://URL/ZZZZ

The work policy must be the next:

request to:

https://URL/XXXX
    Pool1
       Node1 with persistence ck1
       Node2 with Persistence ck2

https://URL/YYYY
    Pool2
       Node1 with persistence ck3
       Node2 with Persistence ck4

https://URL/ZZZZ
    Pool3
       Node1 with persistence ck5
       Node2 with Persistence ck6

To try to do it I have created the next Irule

when HTTP_REQUEST {   
    switch [HTTP::host] {
        https://URL/XXXX {
        Pool1
        }
        https://URL/YYYY {
            Pool2
        }
        https://URL/ZZZZ {
        Pool3
        }
        default { reject }
    }
}

Now I need to insert the cookie to each node. Please could you help finish this configurtion?

Thaks in advance.

Jordi

4 REPLIES 4

nitass
F5 Employee
F5 Employee

Now I need to insert the cookie to each node. Please could you help finish this configurtion?

doesn't default cookie persistence work since pool name is included in cookie name?

K6917: Overview of BIG-IP persistence cookie encoding

https://support.f5.com/csp/article/K6917

by the way, i think the switch should look like this.

switch -glob [HTTP::host][HTTP::uri] {
    "URL/XXXX*" {
        pool Pool1
    }
    ...

Hi nitass,

Thanks for your answer and sorry for my delay.

I want review you suggestion and trying to configure the irule as follow

switch -glob [HTTP::host][HTTP::uri] {
    "https://xxx.xxx.com/xxxxx" {
        pool Pool1
    }
    "https://xxx.xxx.com/yyyyy" {
        pool Pool2
    }
    "https://xxx.xxx.com/zzzzz" {
        pool Pool3
    }
}

Now the original request has changed and I need insert http cookie for each pool.

This is an example:

switch -glob [HTTP::host][HTTP::uri] {
    "https://xxx.xxx.com/xxxxx" {
        pool Pool1
        persist cookie insert <>
    }
    "https://xxx.xxx.com/yyyyy" {
        pool Pool2
        persist cookie insert <>
    }
    "https://xxx.xxx.com/zzzzz" {
        pool Pool3
        persist cookie insert <>
    }
}

Do you think that is this the correct configuration?

Many Thanks,

Jordi

nitass_89166
Noctilucent
Noctilucent

Now I need to insert the cookie to each node. Please could you help finish this configurtion?

doesn't default cookie persistence work since pool name is included in cookie name?

K6917: Overview of BIG-IP persistence cookie encoding

https://support.f5.com/csp/article/K6917

by the way, i think the switch should look like this.

switch -glob [HTTP::host][HTTP::uri] {
    "URL/XXXX*" {
        pool Pool1
    }
    ...

Hi nitass,

Thanks for your answer and sorry for my delay.

I want review you suggestion and trying to configure the irule as follow

switch -glob [HTTP::host][HTTP::uri] {
    "https://xxx.xxx.com/xxxxx" {
        pool Pool1
    }
    "https://xxx.xxx.com/yyyyy" {
        pool Pool2
    }
    "https://xxx.xxx.com/zzzzz" {
        pool Pool3
    }
}

Now the original request has changed and I need insert http cookie for each pool.

This is an example:

switch -glob [HTTP::host][HTTP::uri] {
    "https://xxx.xxx.com/xxxxx" {
        pool Pool1
        persist cookie insert <>
    }
    "https://xxx.xxx.com/yyyyy" {
        pool Pool2
        persist cookie insert <>
    }
    "https://xxx.xxx.com/zzzzz" {
        pool Pool3
        persist cookie insert <>
    }
}

Do you think that is this the correct configuration?

Many Thanks,

Jordi