iRule to redirect http(s) requests to http.

Hi All,

I want to script an iRule which will redirect all http(s) requests to http. I have tried below iRule and doesnt seem to work.

when HTTP_REQUEST {

“]”

}

I get following error when I apply the above iRule to HTTPS VIP

Not Found

The requested URL / was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Can I request assistance from the audience.

Many Thanks!!

Aniket!

Are you getting this on the HTTP VIP? Do you have a client SSL profile applied to the HTTPS VIP?

Hi Kevin,

Thank you for the reply. To answer your questions,

Are you getting this on the HTTP VIP?

--> Yes

Do you have a client SSL profile applied to the HTTPS VIP?

---> Yes we have client SSL profile applied to HTTPS VIP

is your configuration like this?

[root@ve10:Active] config  b virtual bar443 list
virtual bar443 {
   destination 172.28.19.252:443
   ip protocol 6
   rules myrule
   profiles {
      clientssl {
         clientside
      }
      http {}
      tcp {}
   }
}
[root@ve10:Active] config  b rule myrule list
rule myrule {
   when HTTP_REQUEST {
  HTTP::redirect "http://[HTTP::host][HTTP::uri]"
}
}
[root@ve10:Active] config  b virtual bar list
virtual bar {
   snat automap
   pool foo
   destination 172.28.19.252:80
   ip protocol 6
}
[root@ve10:Active] config  b pool foo list
pool foo {
   members 200.200.200.101:80 {}
}

 test

[root@ve10:Active] config  curl -ILk https://172.28.19.252
HTTP/1.0 302 Found
Location: http://172.28.19.252/
Server: BigIP
Connection: Keep-Alive
Content-Length: 0

HTTP/1.1 200 OK
Date: Thu, 11 Jul 2013 08:42:41 GMT
Server: Apache/2.2.3 (CentOS)
Last-Modified: Thu, 23 May 2013 00:28:46 GMT
ETag: "4185a8-59-c3efab80"
Accept-Ranges: bytes
Content-Length: 89
Connection: close
Content-Type: text/html; charset=UTF-8

Hello Nitass,

Thank you for your assistance. Please find the below details.

[user@LB:Active] ~ b virtual Store.sony.ru_https list

virtual Store.sony.ru_https {

snat automap

pool Store.sony.ru

destination 192.168.201.71:https

ip protocol tcp

rules Redirect_https-http

httpclass General_ASM_Transparent

profiles {

http {}

serverssl {

serverside

}

tcp {}

wildcard.sony-europe.com {

clientside

}

}

vlans PRD_web_out enable

}

[user@LB:Active] ~ b rule Redirect_https-http list

rule Redirect_https-http {

when HTTP_REQUEST {

HTTP::redirect “http://[HTTP::host][HTTP::uri]”

}

}

[user@LB:Active] ~ b virtual Store.sony.ru_http list

virtual Store.sony.ru_http {

snat automap

pool Store.sony.ru

destination 192.168.201.71:http

ip protocol tcp

httpclass General_ASM_Transparent

profiles {

http {}

oneconnect {}

tcp {}

}

vlans PRD_web_out enable

}

[user@LB:Active] ~ b pool Store.sony.ru list

pool Store.sony.ru {

monitor all gateway_icmp

members 43.195.193.100:http {}

}

[user@LB:Active] ~ curl -ILk https://192.168.201.71

HTTP/1.0 302 Found

Location: http://192.168.201.71/

Server: BigIP

Connection: Keep-Alive

Content-Length: 0

HTTP/1.1 404 Not Found

Date: Thu, 11 Jul 2013 09:02:31 GMT

Content-Type: text/html; charset=iso-8859-1

Connection: keep-alive

Set-Cookie: TSa27c83=14bf1e2a66541409034277e3c1607a756f88c603ef893f5551de7622; Path=/

Set-Cookie: TSa27c83_28=d41736a185af7c6e35af0dcaf4904b4d6f88c603ef893f5500000000000000000051de76226f88c603ef893f55; Path=/

Transfer-Encoding: chunked

[user@LB:Active] ~

can you try this? if 404 is still returned, can you check whether uri (/) is correct indeed?

curl -i http://43.195.193.100/

Hi, have tried, please find the o/p below:-

[user@LB:Active] ~ curl -i http://192.168.201.71/

HTTP/1.1 404 Not Found

Date: Thu, 11 Jul 2013 09:35:11 GMT

Content-Type: text/html; charset=iso-8859-1

Connection: keep-alive

Content-Length: 317

Set-Cookie: TSa27c83=3d20232befdfea900ffa07b36e79765b896bd9024ab49fa951de7dcb; Path=/

Set-Cookie: TSa27c83_28=7b10b43f835bab99b4ebf63464cfa35f896bd9024ab49fa900000000000000000051de7dca896bd9024ab49fa9; Path=/

404 Not Found

Not Found

The requested URL / was not found on this server.

Additionally, a 404 Not Found

error was encountered while trying to use an ErrorDocument to handle the request.

Hi Nitass,

our application team needs to allow the interested URL, thats why we are getting this error. It was working fine till yesterday so least expected this could be the show stopper.

Thank you for your assistance… I will come back if any issues..