Forum Discussion
HSTS (HTTP Strict Transport Security)
Was trying the HSTS irule posted in "https://devcentral.f5.com/weblogs/d...start.aspx".
The vip on port 80 already had a ssl redirect irule (http to https).
When the below irule is applied to vip of port 80, the site goes down.
==i rule====
iRule for HSTS HTTP Virtuals
when HTTP_REQUEST {
HTTP::respond 301 Location "https://[HTTP::host][HTTP::uri]"
}
when HTTP_RESPONSE {
HTTP::header insert Strict-Transport-Security "max-age=[expr {$static::expires - [clock seconds]}]; \includeSubDomains"
}
============
Few questions (might should foolish) which can help me:
1) Doesnot a ssl redirect solve the purpose?
2) If its a hard and fast rule to apply HSTS feature, can some one suggest where I am going wrong?
Thanks,
Ekanath
- natheCirrocumulusEkanath,
- ekanathdas_2662NimbostratusHi,
- natheCirrocumulusEkanath,
- ekanathdas_2662NimbostratusYes, the virtuals have the http profile associated to them.
- Yasir_Al-MusawiNimbostratus
Your issue is with the clock scan value
it should be [clock scan yyyymmdd]
or you can use this instead of what you are using
==i rule on https virtual===
when HTTP_RESPONSE { HTTP::header insert Strict-Transport-Security "max-age=31536000 ; includeSubDomains" }
- san2hosh_306591Nimbostratus
Well I used the Below Rule. And, my user complained that as the days are passing the time seems to be decreasing. So is their any static rule that can make it same clock seconds everyday?
Here is my rule: when RULE_INIT { set static::expires [clock scan 31536000] } when HTTP_RESPONSE { HTTP::header insert Strict-Transport-Security "max-age=[expr {$static::expires - [clock seconds]}]; includeSubDomains" }
- JGCumulonimbus
when RULE_INIT { set static::expires [clock scan "12 month"] } when HTTP_RESPONSE { HTTP::header insert Strict-Transport-Security "max-age=[expr {$static::expires - [clock seconds]}]; includeSubDomains" }
Recent Discussions
Related Content
* 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