# w3c iRule logging for Virtual Servers having http to https redirection iRule

**URL:** <https://community.f5.com/t/w3c-irule-logging-for-virtual-servers-having-http-to-https-redirection-irule/12897>\
**Category:** Technical Forums\
**Tags:** irules, ltm, application-delivery, http-to-https, logging\
**Created:** [March 6, 2016, 2:11am UTC](https://community.f5.com/t/w3c-irule-logging-for-virtual-servers-having-http-to-https-redirection-irule/12897 "2016-03-06T02:11:56Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![MSK\_222682](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@MSK\_222682](https://community.f5.com/u/MSK_222682)\
**Post date:** [March 6, 2016, 2:11am UTC](https://community.f5.com/t/w3c-irule-logging-for-virtual-servers-having-http-to-https-redirection-irule/12897/1 "2016-03-06T02:11:56Z")

</div>

Hi,

I have been asked to verify the VS without w3c iRule in our LTMs and attach this iRule to them. Now, I have many VS in LTMs which have http to https redirection iRule attached to them and w3c iRule attached to VS listening on https.

Could anyone of you please confirm whether I have to attach w3c iRule to both VS listening on http and https or would it suffice if I only attach it to VS with https as requests to http would be redirected to https VS. If I add w3c to both of the VS (http & https) would this create redundant logs as traffic to VS:http are redirected to VS:https.

Can I have some clarification on this.

Thanks in advance, MSK

---

<div class="post-metadata">

**Author:** ![nitass](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/nitass/32/2270_2.png) [@nitass](https://community.f5.com/u/nitass)\
**Post date:** [March 6, 2016, 2:21am UTC](https://community.f5.com/t/w3c-irule-logging-for-virtual-servers-having-http-to-https-redirection-irule/12897/2 "2016-03-06T02:21:37Z")

</div>

Could anyone of you please confirm whether I have to attach w3c iRule to both VS listening on http and https or would it suffice if I only attach it to VS with https as requests to http would be redirected to https VS. If I add w3c to both of the VS (http & https) would this create redundant logs as traffic to VS:http are redirected to VS:https.

i think only https virtual server. i understand HTTP\_RESPONSE is not triggered by HTTP::redirect command.

e.g.

```tcl
[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
    profiles {
        http { }
        tcp { }
    }
    rules {
        _sys_https_redirect
        qux
    }
    source 0.0.0.0/0
    vs-index 8
}
[root@ve11c:Active:In Sync] config tmsh list ltm rule qux
ltm rule qux {
    when HTTP_REQUEST {
  log local0. ""
}
when HTTP_RESPONSE {
  log local0. ""
}
}
[root@ve11c:Active:In Sync] config 
[root@ve11c:Active:In Sync] config curl -i http://172.28.24.10
HTTP/1.0 302 Found
Location: https://172.28.24.10/
Server: BigIP
Connection: Keep-Alive
Content-Length: 0

[root@ve11c:Active:In Sync] config cat /var/log/ltm
Mar 6 11:19:34 ve11c info tmm[14163]: Rule /Common/qux :
[root@ve11c:Active:In Sync] config

```

---

<div class="post-metadata">

**Author:** ![nitass\_89166](https://avatars.discourse-cdn.com/v4/letter/n/9fc29f/32.png) [@nitass\_89166](https://community.f5.com/u/nitass_89166)\
**Post date:** [March 6, 2016, 2:21am UTC](https://community.f5.com/t/w3c-irule-logging-for-virtual-servers-having-http-to-https-redirection-irule/12897/3 "2016-03-06T02:21:37Z")

</div>

Could anyone of you please confirm whether I have to attach w3c iRule to both VS listening on http and https or would it suffice if I only attach it to VS with https as requests to http would be redirected to https VS. If I add w3c to both of the VS (http & https) would this create redundant logs as traffic to VS:http are redirected to VS:https.

i think only https virtual server. i understand HTTP\_RESPONSE is not triggered by HTTP::redirect command.

e.g.

```tcl
[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
    profiles {
        http { }
        tcp { }
    }
    rules {
        _sys_https_redirect
        qux
    }
    source 0.0.0.0/0
    vs-index 8
}
[root@ve11c:Active:In Sync] config tmsh list ltm rule qux
ltm rule qux {
    when HTTP_REQUEST {
  log local0. ""
}
when HTTP_RESPONSE {
  log local0. ""
}
}
[root@ve11c:Active:In Sync] config 
[root@ve11c:Active:In Sync] config curl -i http://172.28.24.10
HTTP/1.0 302 Found
Location: https://172.28.24.10/
Server: BigIP
Connection: Keep-Alive
Content-Length: 0

[root@ve11c:Active:In Sync] config cat /var/log/ltm
Mar 6 11:19:34 ve11c info tmm[14163]: Rule /Common/qux :
[root@ve11c:Active:In Sync] config

```

---

<div class="post-metadata">

**Author:** ![MSK\_222682](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@MSK\_222682](https://community.f5.com/u/MSK_222682)\
**Post date:** [March 6, 2016, 2:32am UTC](https://community.f5.com/t/w3c-irule-logging-for-virtual-servers-having-http-to-https-redirection-irule/12897/4 "2016-03-06T02:32:50Z")

</div>

Hi nitass, thanks for the quick response. I have the redirection rule as : when HTTP\_REQUEST { HTTP::redirect “https://[HTTP::host][HTTP::uri]” }

---

<div class="post-metadata">

**Author:** ![MSK\_222682](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@MSK\_222682](https://community.f5.com/u/MSK_222682)\
**Post date:** [March 6, 2016, 2:32am UTC](https://community.f5.com/t/w3c-irule-logging-for-virtual-servers-having-http-to-https-redirection-irule/12897/5 "2016-03-06T02:32:50Z")

</div>

Hi nitass, thanks for the quick response. I have the redirection rule as : when HTTP\_REQUEST { HTTP::redirect “https://[HTTP::host][HTTP::uri]” }

---

<div class="post-metadata">

**Author:** ![MSK\_222682](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@MSK\_222682](https://community.f5.com/u/MSK_222682)\
**Post date:** [March 6, 2016, 2:33am UTC](https://community.f5.com/t/w3c-irule-logging-for-virtual-servers-having-http-to-https-redirection-irule/12897/6 "2016-03-06T02:33:02Z")

</div>

when HTTP\_REQUEST { HTTP::redirect “https://[HTTP::host][HTTP::uri]” }

---

<div class="post-metadata">

**Author:** ![MSK\_222682](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@MSK\_222682](https://community.f5.com/u/MSK_222682)\
**Post date:** [March 6, 2016, 2:33am UTC](https://community.f5.com/t/w3c-irule-logging-for-virtual-servers-having-http-to-https-redirection-irule/12897/7 "2016-03-06T02:33:02Z")

</div>

when HTTP\_REQUEST { HTTP::redirect “https://[HTTP::host][HTTP::uri]” }

---

<div class="post-metadata">

**Author:** ![nitass\_89166](https://avatars.discourse-cdn.com/v4/letter/n/9fc29f/32.png) [@nitass\_89166](https://community.f5.com/u/nitass_89166)\
**Post date:** [March 6, 2016, 2:36am UTC](https://community.f5.com/t/w3c-irule-logging-for-virtual-servers-having-http-to-https-redirection-irule/12897/8 "2016-03-06T02:36:46Z")

</div>

I have the redirection rule as :

when HTTP\_REQUEST { HTTP::redirect “https://[HTTP::host][HTTP::uri]” }

you see both (your irule and \_sys\_https\_redirect) use HTTP::redirect command to redirect.

```tcl
root@(ve11c)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm rule _sys_https_redirect
ltm rule _sys_https_redirect {
    nodelete nowrite
when HTTP_REQUEST {
       HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri]
    }
definition-signature mwyl4XlRKRMQc0prWs7RtpgPcNfocOKb+MaFwAnQgAuUZZyG68OaGZsOCN3poUOFdHOc6fk2XAdGRmTRiP/7BCT7thsOX5zLFzA1N1wcr57KWVzEZt3ezxVXn2Z974OmbWm7P5Lclcr7N3adrLJMWfyfPPVF1tUYn0IQPD2QNMmfbcbr1oCuO93n/5dn0s6/EacHZGG53hVibW7xQuJXdMtoQ6ArSZ4U3n4vCDTb6NLYbAj6PirVzKY2pcsWFHFUSVrphSFwERc8+0XGHUE6Cb3ihzygoZc2cQ5jk3frFY70MkDluPTShFRbHd7PlMPRezrfkVZVeUHA/iBPcYcD+w==
    verification-status signature-verified
}

```

---

<div class="post-metadata">

**Author:** ![nitass](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/nitass/32/2270_2.png) [@nitass](https://community.f5.com/u/nitass)\
**Post date:** [March 6, 2016, 2:36am UTC](https://community.f5.com/t/w3c-irule-logging-for-virtual-servers-having-http-to-https-redirection-irule/12897/9 "2016-03-06T02:36:46Z")

</div>

I have the redirection rule as :

when HTTP\_REQUEST { HTTP::redirect “https://[HTTP::host][HTTP::uri]” }

you see both (your irule and \_sys\_https\_redirect) use HTTP::redirect command to redirect.

```tcl
root@(ve11c)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm rule _sys_https_redirect
ltm rule _sys_https_redirect {
    nodelete nowrite
when HTTP_REQUEST {
       HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri]
    }
definition-signature mwyl4XlRKRMQc0prWs7RtpgPcNfocOKb+MaFwAnQgAuUZZyG68OaGZsOCN3poUOFdHOc6fk2XAdGRmTRiP/7BCT7thsOX5zLFzA1N1wcr57KWVzEZt3ezxVXn2Z974OmbWm7P5Lclcr7N3adrLJMWfyfPPVF1tUYn0IQPD2QNMmfbcbr1oCuO93n/5dn0s6/EacHZGG53hVibW7xQuJXdMtoQ6ArSZ4U3n4vCDTb6NLYbAj6PirVzKY2pcsWFHFUSVrphSFwERc8+0XGHUE6Cb3ihzygoZc2cQ5jk3frFY70MkDluPTShFRbHd7PlMPRezrfkVZVeUHA/iBPcYcD+w==
    verification-status signature-verified
}

```

---

<div class="post-metadata">

**Author:** ![MSK\_222682](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@MSK\_222682](https://community.f5.com/u/MSK_222682)\
**Post date:** [March 6, 2016, 2:39am UTC](https://community.f5.com/t/w3c-irule-logging-for-virtual-servers-having-http-to-https-redirection-irule/12897/10 "2016-03-06T02:39:41Z")

</div>

okay. So its enough if we attach w3c iRule only to VS:https instead of both VS:https & VS:http ??

---

<div class="post-metadata">

**Author:** ![MSK\_222682](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@MSK\_222682](https://community.f5.com/u/MSK_222682)\
**Post date:** [March 6, 2016, 2:39am UTC](https://community.f5.com/t/w3c-irule-logging-for-virtual-servers-having-http-to-https-redirection-irule/12897/11 "2016-03-06T02:39:41Z")

</div>

okay. So its enough if we attach w3c iRule only to VS:https instead of both VS:https & VS:http ??

---

<div class="post-metadata">

**Author:** ![MSK\_222682](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@MSK\_222682](https://community.f5.com/u/MSK_222682)\
**Post date:** [March 6, 2016, 3:45am UTC](https://community.f5.com/t/w3c-irule-logging-for-virtual-servers-having-http-to-https-redirection-irule/12897/12 "2016-03-06T03:45:49Z")

</div>

okay. So is it sufficient if we attach w3c iRule only to VS:https instead of both VS:https & VS:http ???

---

<div class="post-metadata">

**Author:** ![MSK\_222682](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@MSK\_222682](https://community.f5.com/u/MSK_222682)\
**Post date:** [March 6, 2016, 3:45am UTC](https://community.f5.com/t/w3c-irule-logging-for-virtual-servers-having-http-to-https-redirection-irule/12897/13 "2016-03-06T03:45:49Z")

</div>

okay. So is it sufficient if we attach w3c iRule only to VS:https instead of both VS:https & VS:http ???

---

<div class="post-metadata">

**Author:** ![nitass](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/nitass/32/2270_2.png) [@nitass](https://community.f5.com/u/nitass)\
**Post date:** [March 6, 2016, 3:56am UTC](https://community.f5.com/t/w3c-irule-logging-for-virtual-servers-having-http-to-https-redirection-irule/12897/14 "2016-03-06T03:56:52Z")

</div>

So its enough if we attach w3c iRule only to VS:https instead of both VS:https & VS:http ??

i think so.

---

<div class="post-metadata">

**Author:** ![nitass\_89166](https://avatars.discourse-cdn.com/v4/letter/n/9fc29f/32.png) [@nitass\_89166](https://community.f5.com/u/nitass_89166)\
**Post date:** [March 6, 2016, 3:56am UTC](https://community.f5.com/t/w3c-irule-logging-for-virtual-servers-having-http-to-https-redirection-irule/12897/15 "2016-03-06T03:56:52Z")

</div>

So its enough if we attach w3c iRule only to VS:https instead of both VS:https & VS:http ??

i think so.

---

<div class="post-metadata">

**Author:** ![MSK\_222682](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@MSK\_222682](https://community.f5.com/u/MSK_222682)\
**Post date:** [March 7, 2016, 1:31am UTC](https://community.f5.com/t/w3c-irule-logging-for-virtual-servers-having-http-to-https-redirection-irule/12897/16 "2016-03-07T01:31:25Z")

</div>

In which case, how we going to log the http traffic coming to the VS ??? As per my understanding the http requests would be forward to VS:https via http:redirect command and then would logged as the VS:https would have the w3c iRule. So, wondering how to log the VS:http traffic.

---

<div class="post-metadata">

**Author:** ![MSK\_222682](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@MSK\_222682](https://community.f5.com/u/MSK_222682)\
**Post date:** [March 7, 2016, 1:31am UTC](https://community.f5.com/t/w3c-irule-logging-for-virtual-servers-having-http-to-https-redirection-irule/12897/17 "2016-03-07T01:31:25Z")

</div>

In which case, how we going to log the http traffic coming to the VS ??? As per my understanding the http requests would be forward to VS:https via http:redirect command and then would logged as the VS:https would have the w3c iRule. So, wondering how to log the VS:http traffic.

---

<div class="post-metadata">

**Author:** ![nitass\_89166](https://avatars.discourse-cdn.com/v4/letter/n/9fc29f/32.png) [@nitass\_89166](https://community.f5.com/u/nitass_89166)\
**Post date:** [March 7, 2016, 10:49am UTC](https://community.f5.com/t/w3c-irule-logging-for-virtual-servers-having-http-to-https-redirection-irule/12897/18 "2016-03-07T10:49:43Z")

</div>

In which case, how we going to log the http traffic coming to the VS ???

if you put log command in HTTP\_REQUEST, you will get log when client hits http virtual server.

---

<div class="post-metadata">

**Author:** ![nitass](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/nitass/32/2270_2.png) [@nitass](https://community.f5.com/u/nitass)\
**Post date:** [March 7, 2016, 10:49am UTC](https://community.f5.com/t/w3c-irule-logging-for-virtual-servers-having-http-to-https-redirection-irule/12897/19 "2016-03-07T10:49:43Z")

</div>

In which case, how we going to log the http traffic coming to the VS ???

if you put log command in HTTP\_REQUEST, you will get log when client hits http virtual server.

---

<div class="post-metadata">

**Author:** ![MSK\_222682](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@MSK\_222682](https://community.f5.com/u/MSK_222682)\
**Post date:** [March 7, 2016, 1:57pm UTC](https://community.f5.com/t/w3c-irule-logging-for-virtual-servers-having-http-to-https-redirection-irule/12897/20 "2016-03-07T13:57:17Z")

</div>

Hi nitass, sorry I didnt get you ?? Can you please elaborate on it. Requirement is to log all the web traffic on our internet facing BIG-IP, which is achieved by attaching w3c iRule but I’m confused for the VS which have both http & https wherein the http VS have https redirection rule.

[Next page](https://community.f5.com/t/w3c-irule-logging-for-virtual-servers-having-http-to-https-redirection-irule/12897.md?page=2)
