Skip to main content

An F5 iRule to set cache-control headers - Community / Feature Request - Deskpro Support

26

An F5 iRule to set cache-control headers Collecting Feedback

This isn't a suggestion, except maybe that you might consider making a knowledgebase article for anyone who might find it useful:

I have created the following iRule for the F5 BIG-IP platform; this iRule can be attached to a pool that services Deskpro and will set the cache-control headers for the /assets/* directory, but leave the rest alone. The code is below, but I'm also attaching it as a text file.

-----------

# this F5 BIG-IP iRule will set the cache-control header for the attached pool, for static Deskpro assets (/assets/*)
# edit the max-age value to the cache timer, 84600 is one week

# grab the URI so we can use it when the response comes back
when HTTP_REQUEST {
set HTTP_URI [HTTP::uri]
}

when HTTP_RESPONSE {
# if the URI is for a static asset (/assets/*)
if { $HTTP_URI starts_with "/assets/" } {
# then set a cache-control header
HTTP::header insert cache-control "max-age=86400"
} }

Add a comment

Please log in or register to submit a comment.

Need a password reminder?

Attachments