tran_93981
Oct 30, 2015Nimbostratus
direct request traffic to the specific directory of another server
I am struggling to write an iRule to achieve this objective:
- if the uri is /engineering/las (http://publicpage.com/engineering/las) then go to node 10.10.10.1:9290/las
- elseif the uri is /engineering/thredds (http://publicpage.com/engineering/thredds)then go to node 10.10.10.1:9290/thredds
- elseif the uri is /coads/las (http://publicpage.com/coads/las)then go to node 10.10.10.1:9280/las (same server as above but different port)
- else go to default pool
My iRules is this
when HTTP_REQUEST {
log local0. "URL:'[HTTP::host][HTTP::uri]'"
if {([HTTP::uri] starts_with "/engineering/las")} {
HTTP::uri "/las"
node 10.10.10.1:9290
log local0. "lAS URL:'[HTTP::host][HTTP::uri]' from [IP::local_addr]"
}
elseif {([HTTP::uri] starts_with "/engineering/thredds")} {
HTTP::uri "/thredds"
node 10.10.10.1:9290
log local0. "THREDDS URL:'[HTTP::host][HTTP::uri]' from [IP::local_addr]"
}
elseif {([HTTP::uri] starts_with "/coads/las")} {
HTTP::uri "/las"
node 10.10.10.1:9280
log local0. "COADS URL:'[HTTP::host][HTTP::uri]' from [IP::local_addr]"
}
}
The problem I am experiencing with this iRule is the pages are not fully displayed (the pages have some script running and it is located on 10.10.10.1:9290/las) and when user click "refresh" then the page will be displayed "not found". I think when it happens like that the uri on the client side is no longer /engineering/thredds, /engineering/las, or /coads/las but it is /las or /thredds so the requests is http://publicpage.com/las not http://publicpage.com/engineering/las which then go to the default pool by the iRule.
Any suggestions, ideas on how to achieve the objective or fix the problem?
Thanks a lot