Forum Discussion
referencing the VS default pool as destination in iRule
Hi Fellows ๐
my customer has the following requirement, the webservice shall be only available via https and ssloffload and in case http traffic arrives, a redirect VS shall do the job, except for certain domains. If the one of the exceptions hits the port80 redirect VS the traffic shall be forwarded to the default pool of the VS in http.
so here is, what i've come up with(untested)
when HTTP_REQUEST {
switch [string tolower [HTTP::host]] {
"www.domain-a.de" { pool pool_mypool_prod-80 }
"www.domain-b.de" { pool pool_mypool_prod-80 }
"www.domain-c.de" { pool pool_mypool_prod-80 }
"default" { HTTP::redirect "https://[HTTP::host][HTTP::uri]" }
}
}
Since i'd like to use the same iRule on preproduction VS and the production VS it would be cool if can reference the assigned default pool of the VS in the iRule.
Thanks in advance David
3 Replies
- nathe
Cirrocumulus
David,
How about something like this:
when CLIENT_ACCEPTED { Save the name of the VS default pool set default_pool [LB::server pool] } when HTTP_REQUEST { switch [string tolower [HTTP::host]] { "www.domain-a.de" - "www.domain-b.de" - "www.domain-c.de" { send these to default pool pool $default_pool } default { HTTP::redirect "https://[HTTP::host][HTTP::uri]" } } }I've not got my lab bigip available to can't test but hopefully it'll do the job you require.
N
- DFeike_160744
Nimbostratus
Hi Nathan,
that's a great idea. Thanks for your advise.
Best regards David
- nathe
Cirrocumulus
no probs
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com