Forum Discussion
Gill_32697
Sep 03, 2013Nimbostratus
redirects with get / post
We have created iRules to perform redirects on existing web services. All the rules appear to work correctly when performing a HTTPGet. However, when connecting from another application, the request ...
- Sep 04, 2013
It get redirected to a GET request
nitass
Sep 04, 2013Employee
e.g.
root@(ve11a)(cfg-sync Not All Devices Synced)(Active)(/Common)(tmos) list ltm virtual bar
ltm virtual bar {
destination 172.28.20.111:80
ip-protocol tcp
mask 255.255.255.255
pool foo
profiles {
http { }
tcp { }
}
rules {
myrule
}
source 0.0.0.0/0
source-address-translation {
type automap
}
vs-index 28
}
root@(ve11a)(cfg-sync Not All Devices Synced)(Active)(/Common)(tmos) list ltm rule myrule
ltm rule myrule {
when HTTP_REQUEST {
if { ([string tolower [HTTP::host]]) contains "unitynet.mysite.com" } {
switch -glob -- [string tolower [HTTP::uri]] {
"*akcelerantws.asmx*" { set ext_url "https://webservices.mysite.com/Unity/Akcelerantws.asmx" }
"*credispherewsv2.asmx*" { set ext_url "http://webservices.mysite.com/Unity/CrediSphereWSV2.asmx" }
"*interfaceservice.asmx*" { set ext_url "https://webservices.mysite.com/Unity/InterfaceService.asmx" }
"*meridianlinkws.asmx*" { set ext_url "https://webservices.mysite.com/Unity[HTTP::uri]" }
"*unitysailws.asmx*" { set ext_url "https://webservices.mysite.com/Unity/UnitySAILWS.asmx" }
"*unityweblet.asmx*" { set ext_url "https://webservices.mysite.com/Unity/UnityWeblet.asmx" }
"*weblet.asmx*" { set ext_url "https://webservices.mysite.com/Unity/UnityWeblet.asmx" }
default {
return
}
}
} else {
return
}
if { [string tolower [HTTP::method]] eq "get" } {
HTTP::redirect $ext_url
} elseif { [string tolower [HTTP::method]] eq "post" } {
if { [HTTP::header exists "Content-Length"] } {
if { [HTTP::header "Content-Length"] > 1048000 }{
set content_length 1048000
} else {
set content_length [HTTP::header "Content-Length"]
}
} else {
set content_length 1048000
}
if { $content_length > 0 } {
HTTP::collect $content_length
}
} else {
do something
}
}
when HTTP_REQUEST_DATA {
set content "< script type=text/javascript language=javascript> \
function s(){ document.f.submit(); } \
"
foreach p [split [HTTP::payload] &] {
set name [URI::decode [getfield $p = 1]]
set value [URI::decode [getfield $p = 2]]
set content "${content}"
}
set content "${content}"
HTTP::respond 200 content $content
}
}
GET
[root@ve11a:Active:Not All Devices Synced] config curl -i http://172.28.20.111/something/akcelerantws.asmx -H "Host: unitynet.mysite.com"
HTTP/1.0 302 Found
Location: https://webservices.mysite.com/Unity/Akcelerantws.asmx
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
POST
[root@ve11a:Active:Not All Devices Synced] config curl -i --data "para1=value1¶2=value2" http://172.28.20.111/something/akcelerantws.asmx -H "Host: unitynet.mysite.com"
HTTP/1.0 200 OK
Server: BigIP
Connection: Keep-Alive
Content-Length: 372
< script type=text/javascript language=javascript> function s(){ document.f.submit(); }
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects