# Write iRule to redirect same node different port

**URL:** <https://community.f5.com/t/write-irule-to-redirect-same-node-different-port/235>\
**Category:** Technical Forums\
**Tags:** dev, irules, devops, application-delivery\
**Created:** [April 8, 2013, 9:01pm UTC](https://community.f5.com/t/write-irule-to-redirect-same-node-different-port/235 "2013-04-08T21:01:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Billy\_10041](https://avatars.discourse-cdn.com/v4/letter/b/5daacb/32.png) [@Billy\_10041](https://community.f5.com/u/Billy_10041)\
**Post date:** [April 8, 2013, 9:01pm UTC](https://community.f5.com/t/write-irule-to-redirect-same-node-different-port/235/1 "2013-04-08T21:01:30Z")

</div>

Need help writing iRule to be use on multiple server where if url contains sso then it get redirected to node on port 8382 else it get redirected to same node on port 443. Would like a iRule that would be use all servers.

---

<div class="post-metadata">

**Author:** ![Kevin\_Stewart](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/kevin_stewart/32/15267_2.png) [@Kevin\_Stewart](https://community.f5.com/u/Kevin_Stewart)\
**Post date:** [April 9, 2013, 3:51am UTC](https://community.f5.com/t/write-irule-to-redirect-same-node-different-port/235/2 "2013-04-09T03:51:02Z")

</div>

Can I assume that the port 443 node is SSL and the port 8382 node is not? If so, you need to apply a server SSL profile to the virtual server and use an iRule like this:

```tcl
when HTTP_REQUEST {
  if { [HTTP::uri] contains "sso"}{
    SSL::disable serverside
    node 1.1.1.1:8382
  } else {
    node 1.1.1.1:443
  }
}

```

The above code makes a few more assumptions. It may be easier to define separate pools (one with port 8382 members and another with port 443 members) and use pool statements instead of node. This way you can properly load balance multiple servers. Also, did you specifically mean that the port 8382 connection had to go to the SAME node that the client may have been previously attached to on port 443?

---

<div class="post-metadata">

**Author:** ![Billy\_10041](https://avatars.discourse-cdn.com/v4/letter/b/5daacb/32.png) [@Billy\_10041](https://community.f5.com/u/Billy_10041)\
**Post date:** [April 9, 2013, 1:06pm UTC](https://community.f5.com/t/write-irule-to-redirect-same-node-different-port/235/3 "2013-04-09T13:06:58Z")

</div>

Thanks that helped
