Forum Discussion

Randyj's avatar
Randyj
Icon for Nimbostratus rankNimbostratus
Jun 20, 2019

HTTPS Redirect, with logging -

I feel sure that this has been asked before, but my search-fu seems weak today.

I have a number of 'redirect' iRules that I'm required to log when they fire - Simplest one being a http --> https redirect. Since upgrading to 14.1, my 'standard' iRule is failing -

Error is in /var.log/ltm:

Jun 20 09:45:14 f5vm011 err tmm7[27649]: 01220001:3: TCL error: /Common/Redirect_HTTPS <HTTP_REQUEST> - ERR_NOT_SUPPORTED (line 2)   invoked from within "HTTP::host"

The rule itself is:

when HTTP_REQUEST {

 HTTP::redirect "https://[HTTP::host][HTTP::uri]"

log local0. "HTTP Request for [HTTP::host][HTTP::uri] from client IP Addr [IP::client_addr] redirected to HTTPS"

}

I understand there is a new command to work with this...

HTTP::has_responded

However, I'm unable to get the syntax correct for it.

Note that when I comment out the 'log local0' stanza, the rule fires correctly, with no errors in /var/log/ltm

Any suggestions ?

Thanks !

1 Reply

  • Hello.

     

    HTTP::has_responded syntax -> https://clouddocs.f5.com/api/irules/HTTP__has_responded.html

     

    But take into account this -> https://devcentral.f5.com/s/question/0D51T00006lU80eSAC/continuous-increase-of-tmm-memory-after-upgradation-to-v14103-and-a-fix-putting-if-httphasresponded-return-in-irule

     

    Also, I recommend you to put the log line before the redirect.

     

    KR,

    Dario.