Route to specific port via URL

Hey all,

I’ve got 2 applications that live on the same webserver:

APPA.DOMAIN.COM and APPB.DOMAIN.COM

APPA listens on port 80, APPB listens on port 3000 on the webserver.

How would I write an iRule such that it routes traffic to the same pool, but different ports, based on the URL? Or is this functionality elsewhere in the F5 than the iRule?

Thanks in advance!

Your best bet is probably separate pools:

when HTTP_REQUEST {
    switch [string tolower [HTTP::host]] {
        "appa.domain.com" { pool appa_pool }
        "appb.domain.com" { pool appb_pool }
    }
}