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...
Robert_Luechte2
Cirrus
Apr 29, 2015Try putting a log statement in before the switch statement so you can see the values you are using in the switch.
log local0. "HTTP Host and path is: [string tolower [HTTP::host][HTTP::uri]]"
Also, do you need to check the host portion? Do you have multiple domains that use this IP address?
- Ahmad_03_151082Apr 29, 2015
Nimbostratus
Hi robert no i donot have multiple domains yes i need to check the host portion I have applied the above i got the below result curl -I oservices.bahrain.bh HTTP/1.0 302 Found location: https://oservices.bahrain.bh/wps/portal Server: BigIP Connection: Keep-Alive Content-Length: 0 curl -I http://oservices.bahrain.bh/pubportal/WebServiceVehicleRegistration/services/Controller HTTP/1.0 302 Found location: https://oservices.bahrain.bh/WebServiceVehicleRegistration/services/Controller Server: BigIP Connection: Keep-Alive Content-Length: 0 curl -I oservices.bahrain.bh/pubportal/InsuranceDetailsUploadWS/services/InsuranceUploadImpl HTTP/1.0 302 Found location: https://oservices.bahrain.bh/InsuranceDetailsUploadWS/services/InsuranceUploadImpl Server: BigIP Connection: Keep-Alive Content-Length: 0 curl -vI http://oservices.bahrain.bh/pubportal/WebServiceVehicleRegistration/services/Controller * About to connect() to oservices.bahrain.bh port 80 (0) * Trying 192.168.214.6... connected * Connected to oservices.bahrain.bh (192.168.214.6) port 80 (0) > HEAD /pubportal/WebServiceVehicleRegistration/services/Controller HTTP/1.1 > User-Agent: curl/7.19.7 (x86_64-suse-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8j zlib/1.2.3 libidn/1.10 > Host: oservices.bahrain.bh > Accept: */* > * HTTP 1.0, assume close after body < HTTP/1.0 302 Found HTTP/1.0 302 Found < location: https://oservices.bahrain.bh/WebServiceVehicleRegistration/services/Controller location: https://oservices.bahrain.bh/WebServiceVehicleRegistration/services/Controller < Server: BigIP Server: BigIP * HTTP/1.0 connection set to keep alive! < Connection: Keep-Alive Connection: Keep-Alive < Content-Length: 0 Content-Length: 0 < * Connection 0 to host oservices.bahrain.bh left intact * Closing connection 0 curl -vI oservices.bahrain.bh/pubportal/InsuranceDetailsUploadWS/services/InsuranceUploadImpl * About to connect() to oservices.bahrain.bh port 80 (0) * Trying 192.168.214.6... connected * Connected to oservices.bahrain.bh (192.168.214.6) port 80 (0) > HEAD /pubportal/InsuranceDetailsUploadWS/services/InsuranceUploadImpl HTTP/1.1 > User-Agent: curl/7.19.7 (x86_64-suse-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8j zlib/1.2.3 libidn/1.10 > Host: oservices.bahrain.bh > Accept: */* > * HTTP 1.0, assume close after body < HTTP/1.0 302 Found HTTP/1.0 302 Found < location: https://oservices.bahrain.bh/InsuranceDetailsUploadWS/services/InsuranceUploadImpl location: https://oservices.bahrain.bh/InsuranceDetailsUploadWS/services/InsuranceUploadImpl < Server: BigIP Server: BigIP * HTTP/1.0 connection set to keep alive! < Connection: Keep-Alive Connection: Keep-Alive < Content-Length: 0 Content-Length: 0 < * Connection 0 to host oservices.bahrain.bh left intact * Closing connection 0 curl -vI oservices.bahrain.bh * About to connect() to oservices.bahrain.bh port 80 (0) * Trying 192.168.214.6... connected * Connected to oservices.bahrain.bh (192.168.214.6) port 80 (0) > HEAD / HTTP/1.1 > User-Agent: curl/7.19.7 (x86_64-suse-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8j zlib/1.2.3 libidn/1.10 > Host: oservices.bahrain.bh > Accept: */* > * HTTP 1.0, assume close after body < HTTP/1.0 302 Found HTTP/1.0 302 Found < location: https://oservices.bahrain.bh/wps/portal location: https://oservices.bahrain.bh/wps/portal < Server: BigIP Server: BigIP * HTTP/1.0 connection set to keep alive! < Connection: Keep-Alive Connection: Keep-Alive < Content-Length: 0 Content-Length: 0 < * Connection 0 to host oservices.bahrain.bh left intact * Closing connection 0 vprwp:/usr/IBM/WebSphere/w - Robert_Luechte2Apr 29, 2015
Cirrus
I'm still confused as to what you are trying to do. Are you saying that you want to do a HTTP to HTTPS redirect for everything except if the URI has the word /pubportal in it? Or are you looking for specific URLs that have /pubportal in them and choosing not to redirect those? Because I'm not sure what you are saying with /pubportal/something or /pubportal/anything. If you can clarify what you are doing it will help. - Ahmad_03_151082Apr 29, 2015
Nimbostratus
let me explain it again I need to enable SSL on http://oservices.bahrain.bh to enablae SSL i applied the below iRule when HTTP_REQUEST { HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri] } Now I want to exclude the below URLs http://oservices.bahrain.bh/pubportal/WebServiceVehicleRegistration/services/Controller http://oservices.bahrain.bh/pubportal/InsuranceDetailsUploadWS/services/InsuranceUploadImpl
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