For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Corey_Webb_9791's avatar
Corey_Webb_9791
Icon for Nimbostratus rankNimbostratus
Dec 18, 2007

Redirect HTTP to HTTPS without using HTTP_REQUEST trigger

I need to redirect traffic that comes to my VIP as http:\\x.y.z to https:\\x.y.z however since there is no actual HTTP_REQUEST triggered when the request comes in as http I need to trigger this redirect with some other trigger that happens before the request like port or client address but none of these seem to allow for the HTTP::redirect command to be issued. Any Ideas???

 

 

Thank you,

 

Corey

26 Replies

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    Typos will get even the best of us from tiem to tiem. :p

     

     

    Glad to hear it's working for you.

     

     

    Colin
  • Hoolio, I am seeing the following errors using your rule

     

     

     

    Jan 17 13:55:46 tmm tmm[938]: Rule rule_http2https-1vs : ---------------------------- Start ----------------------------

     

    Jan 17 13:55:46 tmm tmm[938]: Rule rule_http2https-1vs : HTTPS request from 10.20.47.82 to 10.20.15.4:443

     

    Jan 17 13:55:46 tmm tmm[938]: 01220001:3: TCL error: Rule rule_http2https-1vs - can't read "vip_http_port": no such variable

     

    while executing "if { ($::redirect_http_to_https == 1 or ([info exists redirect_http_to_https] && $redirect_http_to_https)) and $vip_http_port==1}{

     

    HTTP::redirec..."

     

     

     

     

    any ideas?
  • Hoolio

     

     

    I am gettting the following errors when using your example

     

     

     

    Jan 17 13:55:46 tmm tmm[938]: Rule rule_http2https-1vs : ---------------------------- Start ----------------------------

     

    Jan 17 13:55:46 tmm tmm[938]: Rule rule_http2https-1vs : HTTPS request from 10.20.47.82 to 10.20.15.4:443

     

    Jan 17 13:55:46 tmm tmm[938]: 01220001:3: TCL error: Rule rule_http2https-1vs - can't read "vip_http_port": no such variable

     

    while executing "if { ($::redirect_http_to_https == 1 or ([info exists redirect_http_to_https] && $redirect_http_to_https)) and $vip_http_port==1}{

     

    HTTP::redirec..."

     

     

     

     

    Any ideas?

     

    -L
  • sorry for the double post, did not see page 2. also I set the port on the VS to * (forgot that step). Here is more log info as well as the HTTP header info.

     

     

    HTTP HEADER

     

     

    GET /pwdmgr/default.aspx HTTP/1.1

     

    Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*

     

    Accept-Language: en-us

     

    Accept-Encoding: gzip, deflate

     

    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; InfoPath.1; .NET CLR 2.0.50727)

     

    Host: 10.20.15.4

     

    Connection: Keep-Alive

     

     

    HTTP/1.0 302 Found

     

    Location: https://10.20.15.4/pwdmgr/default.aspx

     

    Server: BigIP

     

    Connection: Keep-Alive

     

    Content-Length: 0

     

     

    GET /pwdmgr/default.aspx HTTP/1.1

     

    Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*

     

    Accept-Language: en-us

     

    Accept-Encoding: gzip, deflate

     

    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; InfoPath.1; .NET CLR 2.0.50727)

     

    Host: 10.20.15.4

     

    Connection: Keep-Alive

     

     

     

     

    BIGIP LOG

     

     

    Jan 17 14:28:17 tmm tmm[938]: Rule rule_http2https-1vs : ---------------------------- Start -----------------------

     

    -----

     

    Jan 17 14:28:17 tmm tmm[938]: Rule rule_http2https-1vs : HTTP request from 10.20.47.82 to 10.20.15.4:80

     

    Jan 17 14:28:17 tmm tmm[938]: Rule rule_http2https-1vs : Client SSL profile enabled on VIP. Disabling SSL

     

    Jan 17 14:28:17 tmm tmm[938]: Rule rule_http2https-1vs : redirecting client 10.20.47.82 to https://10.20.15.4/pwdmgrle

     

    novo/default.aspx

     

    Jan 17 14:28:17 tmm tmm[938]: Rule rule_http2https-1vs : ---------------------------- Start -----------------------

     

    -----

     

    Jan 17 14:28:17 tmm tmm[938]: Rule rule_http2https-1vs : HTTPS request from 10.20.47.82 to 10.20.15.4:443

     

    Jan 17 14:28:19 tmm tmm[938]: Rule rule_http2https-1vs : ---------------------------- Start -----------------------

     

    -----

     

    Jan 17 14:28:19 tmm tmm[938]: Rule rule_http2https-1vs : HTTPS request from 10.20.47.82 to 10.20.15.4:443

     

    Jan 17 14:28:19 tmm tmm[938]: 01220001:3: TCL error: Rule rule_http2https-1vs - can't read "vip_http_port": no such v

     

    ariable while executing "if { ($::redirect_http_to_https == 1 or ([info exists redirect_http_to_https] && $redirect_http_to_http

     

    s)) and $vip_http_port==1}{ HTTP::redirec..."

     

     

  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    Hi lsouth,

     

     

    I was checking to see if $vip_http_port was set to 1, but wasn't setting it for HTTPS connections. I added a check to see if the variable exists before trying to see if it is set to 1.

     

     

    Can you give that a shot?

     

     

    Thanks,

     

    Aaron

     

  • works like a champ. Thanks Hoolio..this is an awesome rule, but MAN there is a lot too it.

     

     

    Regards,

     

    -L