Manual Chapter : iFiles

Applies To:

Show Versions Show Versions

BIG-IP AAM

  • 14.0.1, 14.0.0, 13.1.5, 13.1.4, 13.1.3, 13.1.1, 13.1.0, 13.0.1, 13.0.0, 12.1.5, 12.1.3, 12.1.2, 12.1.1, 12.1.0, 11.6.3, 11.6.2, 11.6.1

BIG-IP APM

  • 14.0.1, 14.0.0, 13.1.5, 13.1.4, 13.1.3, 13.1.1, 13.1.0, 13.0.1, 13.0.0, 12.1.6, 12.1.5, 12.1.3, 12.1.2, 12.1.1, 12.1.0, 11.6.3, 11.6.2, 11.6.1

BIG-IP GTM

  • 11.6.3, 11.6.2, 11.6.1

BIG-IP Link Controller

  • 14.0.1, 14.0.0, 13.1.5, 13.1.4, 13.1.3, 13.1.1, 13.1.0, 13.0.1, 13.0.0, 12.1.6, 12.1.5, 12.1.3, 12.1.2, 12.1.1, 12.1.0, 11.6.3, 11.6.2, 11.6.1

BIG-IP Analytics

  • 14.0.1, 14.0.0, 13.1.5, 13.1.4, 13.1.3, 13.1.1, 13.1.0, 13.0.1, 13.0.0, 12.1.6, 12.1.5, 12.1.3, 12.1.2, 12.1.1, 12.1.0, 11.6.3, 11.6.2, 11.6.1

BIG-IP LTM

  • 14.0.1, 14.0.0, 13.1.5, 13.1.4, 13.1.3, 13.1.1, 13.1.0, 13.0.1, 13.0.0, 12.1.6, 12.1.5, 12.1.3, 12.1.2, 12.1.1, 12.1.0, 11.6.3, 11.6.2, 11.6.1

BIG-IP PEM

  • 14.0.1, 14.0.0, 13.1.5, 13.1.4, 13.1.3, 13.1.1, 13.1.0, 13.0.1, 13.0.0, 12.1.6, 12.1.5, 12.1.3, 12.1.2, 12.1.1, 12.1.0, 11.6.3, 11.6.2, 11.6.1

BIG-IP AFM

  • 14.0.1, 14.0.0, 13.1.5, 13.1.4, 13.1.3, 13.1.1, 13.1.0, 13.0.1, 13.0.0, 12.1.6, 12.1.5, 12.1.3, 12.1.2, 12.1.1, 12.1.0, 11.6.3, 11.6.2, 11.6.1

BIG-IP DNS

  • 14.0.1, 14.0.0, 13.1.5, 13.1.4, 13.1.3, 13.1.1, 13.1.0, 13.0.1, 13.0.0, 12.1.6, 12.1.5, 12.1.3, 12.1.2, 12.1.1, 12.1.0

BIG-IP ASM

  • 14.0.1, 14.0.0, 13.1.5, 13.1.4, 13.1.3, 13.1.1, 13.1.0, 13.0.1, 13.0.0, 12.1.6, 12.1.5, 12.1.3, 12.1.2, 12.1.1, 12.1.0, 11.6.3, 11.6.2, 11.6.1
Manual Chapter

About file import for iRules

If you want to write an iRule that references a file that resides on another system, you must first import the file to the BIG-IP system. You can then convert the file to an iFile that an iRule can reference.

Importing a file for an iRule

Before you perform this task, the file you want to import must reside on the system you specify.
You can import a file from another system onto the BIG-IP system, as the first step in writing an iRule that references that file.
  1. On the Main tab, click System > File Management > iFile List > Import.
  2. For the File Name setting, click Browse. The system opens a browse window so that you can locate the file that you want to import to the BIG-IP system.
  3. Browse for the file and click Open. The name of the file you select appears in the File Name setting.
  4. In the Name field, type a new name for the file, such as 1k.html. The new file name appears in the list of imported files.
  5. Click the Import button.
After you perform this task, the file that you imported resides on the BIG-IP system.

Viewing a list of imported files

You perform this task to view a list of files that you have imported to the BIG-IP system for the purpose of referencing the files within iRules.
  1. On the Main tab, click System > File Management > iFile List.
  2. In the Name column, view the list of iFiles.
  3. Click the Cancel button.

About iFiles

Using the BIG-IP Configuration utility, you can create a special file called an iFile. An iFile is a file that is based on an external file that you previously imported to the BIG-IP system from another system. You can reference an iFile from within an iRule, based on a specific iRule event.

To create an iFile and use it within an iRule, you start from the Local Traffic option on the Main tab.

Important: Prior to creating an iFile, you must import a file to the BIG-IP system from another system.

Viewing a list of iFiles

You perform this task to view a list of files that you have imported to the BIG-IP system for the purpose of referencing the files within iRules.
  1. On the Main tab, click Local Traffic > iRules > iFile List.
  2. In the Name column, view the list of iFiles that you peviously created on the BIG-IP system.

Creating an iFile

As a prerequisite, ensure that the current administrative partition is set to the partition in which you want the iFile to reside. Also ensure that the file has been imported to the BIG-IP system.
You perform this task to create an iFile that you can then reference in an iRule.
  1. On the Main tab, click Local Traffic > iRules > iFile List.
  2. Click Create.
  3. In the Name field, type a new name for the iFile, such as ifileURL.
  4. From the File Name list, select the name of the imported file object, such as 1k.html.
  5. Click Finished. The new iFile appears in the list of iFiles.
The result of this task is that you now have a file that an iRule can reference.

iRule commands for referencing an iFile

With these iRule commands, you can reference the new iFile from within an iRule:

  • [ifile get IFILENAME]
  • [ifile listall]
  • [ifile attributes IFILENAME]
  • [ifile size IFILENAME]
  • [ifile last_updated_by IFILENAME]
  • [ifile last_update_time IFILENAME]
  • [ifile revision IFILENAME]
  • [ifile checksum IFILENAME]
  • array set [file attributes IFILENAME]

This sample iRule shows some of these commands:

ltm rule ifile_rule { when HTTP_RESPONSE { # return a list of iFiles in all partitions set listifiles [ifile listall] log local0. "list of ifiles: $listifiles" # return the attributes of an iFile specified array set array_attributes [ifile attributes "/Common/ifileURL"] foreach {array attr} [array get array_attributes ] { log local0. "$array : $attr" } # serve an iFile when http status is 404. set file [ifile get "Common/ifileURL"] log local0. "file: $ifile" if { [HTTP::status] equals "404" } { HTTP::respond 200 ifile "/Common/ifileURL" } } }