Forum Discussion
jonathan_voigt_
Nimbostratus
Nov 06, 2009url rewrite and routing
Hi,
I need have a single dns (VSA) capable of routing to multiple pools based on context (e.g. /en/ or /fr/ , however, the web app's on these pools is the same. One supports english and one supports french, however there is no way to distinguish the two witout using separate pools.
I basically need to:
1. access a url with /en/ as context and route to pool 1, however, remove /en/ from uri before routing.
2. access a url with /fr/ as context and route to pool 2, however, remove /fr/ from uri before routing.
i know this is possible, but wondering if there is an easy way to accomplish this.
thanks in advance!
- jonathan_voigt_
Nimbostratus
please disregard this one as it's not possible without setting some special cookie once user is determined (french/english) as there is no unique identifier to determine where to send user after english or french selection - hoolio
Cirrostratus
You could check the start of the URI, select a pool, set a "pool" cookie to track the correct pool and insert a persistence cookie to ensure the client is persisted to the same language pool and same pool member. If that sounds like an option for you, reply and we can come up with an example. - jonathan_voigt_
Nimbostratus
The cookie solution would work, can you help with this? - hoolio
Cirrostratus
Here's something to start with:when HTTP_REQUEST { Make sure to add a OneConnect profile with this iRule http://devcentral.f5.com/wiki/default.aspx/AdvDesignConfig/oneconnect If language already exists from prior HTTP request on same TCP connection, unset it if {[info exists language]}{ unset language } Check requested path switch -glob [HTTP::path] { "/en/* { set language "en" pool pool_en } "/fr/*" { set language "fr" pool pool_fr } default { No language prefix in the path, so check if pool selector cookie has a value if {[HTTP::cookie value "lang"] ne ""}{ Select pool based on cookie value switch [HTTP::cookie value "lang"] { "en" { pool pool_en } "fr" { pool pool_fr } } } } } If there was a language prefix in the URI, remove it if {[info exists language]}{ Remove /en/ or /fr/ from the requested path HTTP::path [string range [HTTP::path] 0 3] } } when HTTP_RESPONSE { Set a pool selector cookie in response if {[info exists language]}{ HTTP::cookie insert name "lang" value $language path / } }
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects