Forum Discussion
Ahmad_03_151082
Nimbostratus
Apr 29, 2015HTTP to HTTPs exclude URLs
Hello
I am facing problem with my iRule which is redirect HTTP to HTTPs
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::host][HTTP::uri]] {
"xyz.com/pubportal/something" -
"xy...
nitass
Employee
May 14, 2015do you mean there is aconflict betwenn these two iRule?
e.g.
configuration
[root@ve11c:Active:In Sync] config tmsh list ltm virtual bar
ltm virtual bar {
destination 172.28.24.10:80
ip-protocol tcp
mask 255.255.255.255
pool foo
profiles {
http { }
tcp { }
}
rules {
one
two
}
source 0.0.0.0/0
source-address-translation {
type automap
}
vs-index 7
}
[root@ve11c:Active:In Sync] config tmsh list ltm rule one
ltm rule one {
when HTTP_REQUEST {
if { [HTTP::uri] equals "/" } {
switch [string tolower [HTTP::host]] {
"oservices.bahrain.bh" { HTTP::uri "/wps/portal"}
"www.data.gov.bh" { HTTP::uri "/wps/portal/data" }
"www.fsupport.gov.bh" { HTTP::uri "/wps/portal/fsupport" }
"www.biciactions.bh" { HTTP::uri "/wps/portal/BICI" }
"www.ega.gov.bh" { HTTP::uri "/wps/portal/egaptl" }
"www.govactions.bh" { HTTP::uri "/wps/portal/EgovBICI" }
"business.bahrain.bh" { HTTP::uri "/wps/portal/business" }
"individual.bahrain.bh" { HTTP::uri "/wps/portal/individual" }
"contact.bahrain.bh" { HTTP::uri "/wps/portal/contactus" }
"visit.bahrain.bh" { HTTP::uri "/wps/portal/visit" }
"eParticipation.bahrain.bh" { HTTP::uri "/wps/portal/eParticipation" }
"participate.bahrain.bh" { HTTP::uri "/wps/portal/participation" }
"government.bahrain.bh" { HTTP::uri "/wps/portal/government" }
"environment.bahrain.bh" { HTTP::uri "/wps/portal/environment" }
}
} else {
switch -glob [HTTP::path] {
"/wps/portal/NCCA" { HTTP::redirect "http://services.bahrain.bh/wps/portal/TawasulBe" }
"/neaf" { HTTP::uri "/wps/portal/neaf" }
"/Tawasul" { HTTP::uri "/wps/portal/ncs" }
"/tawasul" { HTTP::uri "/wps/portal/ncs" }
"/pubportal*" { HTTP::uri "[string range [HTTP::uri] 10 end]" }
"/apps" { HTTP::redirect "https://apps.bahrain.bh/CMSWebApplication/action/AppStoreAction" }
"/GovAppStar" { HTTP::uri "/wps/portal/GovAppStar" }
"/blog" { HTTP::uri "/wps/portal/blog" }
"/search" { HTTP::uri "/wps/portal/searchhomear" }
"/mobile" { HTTP::redirect "http://mobile.bahrain.bh" }
"/business" { HTTP::uri "/wps/portal/business" }
"/mobile/Events" { HTTP::redirect "http://mobile.bahrain.bh/egov/wap/wml/mobile/common/calltoursub.do" }
"/mobile/Hotel" { HTTP::redirect "http://mobile.bahrain.bh/egov/wap/wml/mobile/common/callhoteldir.do" }
}
}
}
}
[root@ve11c:Active:In Sync] config tmsh list ltm rule two
ltm rule two {
when HTTP_REQUEST {
if { !( ([HTTP::uri] contains "WebServiceVehicleRegistration") or ([HTTP::uri] contains "InsuranceDetailsUploadWS") ) } {
HTTP::redirect https://[HTTP::host][HTTP::uri]
}
}
}
test
[root@ve11c:Active:In Sync] config curl -I http://172.28.24.10/wps/portal/NCCA
HTTP/1.0 302 Found
Location: http://services.bahrain.bh/wps/portal/TawasulBe
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
[root@ve11c:Active:In Sync] config tail /var/log/ltm
May 14 15:37:16 ve11c err tmm[15145]: 01220001:3: TCL error: /Common/two - Operation not supported. Multiple redirect/respond invocations not allowed (line 1) invoked from within "HTTP::redirect https://[HTTP::host][HTTP::uri] "
Ahmad_03_151082
Nimbostratus
May 14, 2015for
http://oservices.bahrain.bh/wps/portal/NCCA it will redirect you to another domain http://services.bahrain.bh and I have enabled the SSL on this domain also,so i changed the iRule
"/wps/portal/NCCA" { HTTP::redirect "http://services.bahrain.bh/wps/portal/TawasulBe"
to
"/wps/portal/NCCA" { HTTP::redirect "https://services.bahrain.bh/wps/portal/TawasulBe"
but still get the same error.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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