# A10 vThunder ADC/SLB - Redirection based on URL

**URL:** <https://community.a10networks.com/t/a10-vthunder-adc-slb-redirection-based-on-url/775>\
**Category:** aFleX\
**Tags:** redirect, aflex, load-balancing-method, a10-thunder\
**Created:** [May 9, 2023, 4:24pm UTC](https://community.a10networks.com/t/a10-vthunder-adc-slb-redirection-based-on-url/775 "2023-05-09T16:24:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![wtegga10](https://avatars.discourse-cdn.com/v4/letter/w/71e660/32.png) [@wtegga10](https://community.a10networks.com/u/wtegga10)\
**Post date:** [May 9, 2023, 4:24pm UTC](https://community.a10networks.com/t/a10-vthunder-adc-slb-redirection-based-on-url/775/1 "2023-05-09T16:24:25Z")

</div>

- Hello,  
I will try to do more research to see if this was already covered in another post, but so far haven’t been able to find exactly what I’m looking for.  
Is it possible to do a redirect based on which URL the end user goes to for whats described below? Or is this completely wrong and I should be looking for an alternative solution?  
Say you have an internal application you want to pass through. So you have the following  
virtual server 10.1.1.10 with port 443  
Now based on what URL they go to will determine the farm they access.
- [https://10.1.1.10/website](https://10.1.1.10/website) will use farm 1
- [https://10.1.1.10/website/purchasing](https://10.1.1.10/website/purchasing) will use farm 2
- [https://10.1.1.10/engineering](https://10.1.1.10/engineering) will use farm 3

I probably have this all wrong, but I’ll keep working on it to see what I can come up with.

Thanks!

---

<div class="post-metadata">

**Author:** ![dquinn](https://avatars.discourse-cdn.com/v4/letter/d/858c86/32.png) [@dquinn](https://community.a10networks.com/u/dquinn)\
**Post date:** [May 9, 2023, 5:25pm UTC](https://community.a10networks.com/t/a10-vthunder-adc-slb-redirection-based-on-url/775/2 "2023-05-09T17:25:03Z")

</div>

You should be able to accomplish this with a http template, this is in the following guide  
[https://documentation.a10networks.com/ACOS/600x/ACOS\_6\_0\_0-P2/pdf/Application\_Delivery\_Controller.pdf](https://documentation.a10networks.com/ACOS/600x/ACOS_6_0_0-P2/pdf/Application_Delivery_Controller.pdf)  
here is an example from the ADC config guide  
ACOS(config)# slb template http urlswitch  
ACOS(config-http)# url-switching starts-with /abc service-group sg-abc  
ACOS(config-http)# url-switching starts-with /123 service-group sg-123  
ACOS(config-http)# exit  
ACOS(config)# slb virtual-server vs1 1.1.1.1  
ACOS(config-slb vserver)# port 80 http  
ACOS(config-slb vserver-vport)# template http urlswitch  
ACOS(config-slb vserver-vport)# service-group sg-abc

---

<div class="post-metadata">

**Author:** ![wtegga10](https://avatars.discourse-cdn.com/v4/letter/w/71e660/32.png) [@wtegga10](https://community.a10networks.com/u/wtegga10)\
**Post date:** [May 9, 2023, 5:37pm UTC](https://community.a10networks.com/t/a10-vthunder-adc-slb-redirection-based-on-url/775/3 "2023-05-09T17:37:00Z")

</div>

Sorry for the dumb post. I think I got it figured out. The only thing I’m not sure of is the whole starts\_with option. So clearly if we do a starts\_with “website” it’ll be redirected right away not allowing it to hit the purchasing page. Sure I could reorder it, but I want to think of another way to do it.

when HTTP\_REQUEST {  
&nbsp;if {[HTTP::uri] starts\_with “/website”} {  
&nbsp;&nbsp;pool farm1  
&nbsp;} elseif {[HTTP::uri] starts\_with “/purchasing”} {  
&nbsp;&nbsp;pool farm2  
&nbsp;} elseif {[HTTP::uri] starts\_with “/engineering”} {  
&nbsp;&nbsp;pool farm3  
&nbsp;}  
}

---

<div class="post-metadata">

**Author:** ![wtegga10](https://avatars.discourse-cdn.com/v4/letter/w/71e660/32.png) [@wtegga10](https://community.a10networks.com/u/wtegga10)\
**Post date:** [May 9, 2023, 6:12pm UTC](https://community.a10networks.com/t/a10-vthunder-adc-slb-redirection-based-on-url/775/4 "2023-05-09T18:12:03Z")

</div>

Awesome! Thats exactly what I was looking for. Way better than what I was about to do hahaha.

Thanks again!
