Skip to main content

Headers Manipulation

Headers Manipulation allows users to add, remove, or modify request and response headers or header values.

The Header Manipulation script is designed to control HTTP headers dynamically across both requests and responses within the CacheFly environment. This functionality is essential for tailoring interactions between clients and the server to meet specific requirements or behaviors.

To add a Headers Manipulation script config to the list of script configs created for your CacheFly services in general, or to associate a Headers Manipulation script config with a specific CacheFly service, see Adding and Using Script Configs.

Using The Headers Manipulation Script Config

The Headers Manipulation script config offers several functions:

  • Add Headers: Headers can be added to every CacheFly Content Distribution Network (CDN) request or response. Specific attributes such as name and value define the header itself, while addToRequest and addToResponse define when and how headers are added.

    • addToRequest options:

      • ALWAYS: Always add the header to the request headers

      • NEVER: Never add the header to the request headers

    • addToResponse options:

      • ALWAYS: Always add the header to the response headers

      • NEVER: Never add the header to the response headers

      • IF_NOT_EXISTS: Only add the header to the response headers if the header name doesn't already exist.

  • Delete Headers: Headers can be removed from the request or response, ensuring that unwanted or sensitive information is not passed along in network communications. Specific attributes such as name define the header itself, while deleteFromRequest and deleteFromResponse define if the header should be deleted.

    • Both the deleteFromRequest and deleteFromResponse properties are Boolean types and require either a true or false value.

These functions can be used in one or both of the following ways:

  • Via the default key, which allows you to specify the default behavior of the CDN.

  • Via the exceptions key, which allows you to specify paths for which the default header rules do not apply. Within these paths, custom header configurations can be implemented, allowing for precise control based on URL paths.

Editing The Headers Manipulation Script Config

When you add the Headers Manipulation script config to your list of script configs in CacheFly, it will initially display a default configuration as a model for you to adapt to your own requirements.

To edit this default configuration:

  • Click the blue Edit button to enter edit mode

  • Modify the script config as you require

  • Remember to click the blue ✔ Save Changes button to save your changes.

As you edit:

  • The CacheFly system shows on-screen prompts to help you select acceptable parameters and values.

  • The blue ✔ Save Changes button will be partially grayed out and will be inactive, until the system confirms that your edits are acceptable.

  • You can cancel your current edits by clicking the gray Cancel button.

Scroll the graphics in this step horizontally to see all the screens.

Additional Help Topics

As an alternative to creating and managing script configs via the CacheFly user interface as described in this guide, you can also create and manage script configs via API calls.

Click the gray API docs button to access the Script Configs section in CacheFly's online API documentation for further information.