Forum Discussion
iRule redirect with URL masking and URI rewrite
- Aug 09, 2017
Hi,
You can't achieve what you are expecting without using iframes. But I strongly discourage you to use them for security reasons.
You can instead redirect to a relative path and then forward the request to the correct backend server :
`
when HTTP_REQUEST { if { [HTTP::host] contains "buyer.abc.com" and [HTTP::path] eq "/" } { HTTP::redirect "/apm/rest/MOBILITY/authService/1.0" return } if {[HTTP::host] contains "buyer.abc.com" and [HTTP::path] eq "/apm/rest/MOBILITY/authService/1.0"} { node myserver01 9001 return } }
`
Hi,
You can't achieve what you are expecting without using iframes. But I strongly discourage you to use them for security reasons.
You can instead redirect to a relative path and then forward the request to the correct backend server :
`
when HTTP_REQUEST {
if { [HTTP::host] contains "buyer.abc.com" and [HTTP::path] eq "/" } {
HTTP::redirect "/apm/rest/MOBILITY/authService/1.0"
return
}
if {[HTTP::host] contains "buyer.abc.com" and [HTTP::path] eq "/apm/rest/MOBILITY/authService/1.0"} {
node myserver01 9001
return
}
}
`
Hi Yann,
This one worked fine and I was able to map the virtual server instead of the node. However the issue is that the subsequent URIs are not working after the first page is loaded fine. So I removed the redirection part and configured the following iRule to send the traffic directly to the virtual server.
As the initial request comes on port 443, I created a virtual server with port 443 and called the following iRule without adding any pool to it. Also configured another virtual server with port 9001 and added pool with member listening on port 9001. However this doesn't work for some reason
when HTTP_REQUEST {
if { [HTTP::host] contains "buyer.abc.com" and [HTTP::path] eq "/" } {
virtual buyer_vs_9001
return
}
Recent Discussions
Related Content
* 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