Creating a Cache behavior

Cache behaviors help you define how FlashEdge handles caching, compression, and caching policies for specific paths or file types.

Access FlashEdge Cache behavior configuration

Follow these steps to create or edit cache behaviors:

Accessing Cache Behavior Configuration

  1. Sign in to the FlashEdge.

  2. Choose the distribution for which you want to create a certificate.

  3. Choose the Cache tab.

  4. Click on the “Create new behavior” or “Edit” button next to the behavior that you want to configure.

Configure FlashEdge Cache behavior

You'll find the following options to configure:

  1. Cache Behavior Details

    • Select Origin: Choose the origin (e.g., origin1) to which this cache behavior will apply.

    • Path or File Type Selection: Specify the path or file types you want to customize caching for. You can use asterisks as wildcards to match directories or file types. For instance:

      • /path/to/assets/* for a specific directory.

      • /*.html, /*.jpg, /*.js for specific file types. Remember, path and file type entries are case-sensitive.

  2. Object Compression: Choose to enable or disable object compression. Enabling this feature allows your distribution to serve compressed objects to viewers who support them, improving performance.

    • Compression enabled: This function aims to improve the delivery of web content by reducing the amount of data transferred between the origin server and the end user's device. FlashEdge can compress objects using Gzip and Brotli.

    • Compression disabled: This means that the compression is disabled for the selected cache behavior.

  3. Redirect HTTP/HTTPS: Choose a redirection option to ensure secure connections between viewers and your origin:

    • HTTP and HTTPS: No specific redirection, both protocols are allowed.

    • Redirect HTTP to HTTPS: Redirects all HTTP requests to HTTPS for encryption.

    • HTTPS only: Enforces HTTPS connections only.

  4. Cache Policy: Select a pre-configured cache behavior that fits your content:

    • Cache everything (Best for static content): Caches and serves your entire website as static content. Ideal for content that remains constant across users or relies less on cookies and headers.

    • Cache nothing (Best for dynamic content): Disables caching entirely; suitable for personalized content using cookies, headers, and query strings.

    • *Custom cache (Advanced cache settings): Allows tailored cache settings, suitable for advanced users requiring specific caching configurations.

  5. Custom Review and Confirmation

    Continue below this paragraph if you selected “Custom cache (Advanced cache settings)“.

    • Double-check your cache behavior settings.

    • Once satisfied, click on the "Create/Edit Cache Behavior" button.

* Advanced Cache Settings (For "Custom cache" Option)

After selecting the "Custom cache (Advanced cache settings)" option, access the advanced cache configuration settings.

  1. Time-to-Live (TTL) Cache Policy: Specify that the maximum time objects stay in the cache before expiring. Choose TTL duration in days, hours, minutes, or seconds.

  2. Allowed HTTP Methods: Define which HTTP methods your distribution will process and forward to your origin.

    • GET, HEAD: Only GET and HEAD methods are forwarded.

    • GET, HEAD, OPTIONS: Additionally, the OPTIONS method is forwarded.

    • GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE: All listed methods are forwarded.

  3. Header Forwarding: Choose how headers are handled when communicating with your origin:

    • Forward Default Headers: This option is suitable for most cases. It forwards essential headers like "User-Agent" and "Accept-Encoding" that help your origin provide accurate responses based on viewer capabilities.

    • Forward All Headers: You might choose this option to ensure that all headers are forwarded to your origin server.

    • Forward Headers I Specify: For your API, you might select this option and specify headers like "Accept-Language" and "X-Custom-Header". Only these specified headers will be sent to your origin.

  4. Cookie Forwarding: Choose how cookies are managed when forwarding requests to your origin:

    • Don't Forward Cookies: For example, this might be suitable for static product pages. Such pages don't rely on user-specific cookies for content differentiation.

    • Forward All Cookies: For user personalization and tracking, you would choose this option. It ensures that cookies containing user session details, preferences, or any other content are forwarded to your origin, leading to a seamless shopping experience.

    • Forward Cookies I Specify: Suppose that your application uses cookies named "UserSession" and "CartItems". You'd select this option and specify these cookies. This way, only those specific cookies, critical for your app functionality, are sent to your origin.

  5. Query String Forwarding: Decide how query strings (?your=query-strings) are managed when interacting with your origin:

    • Don't Forward Query Strings: If your app doesn't rely on query string parameters to function correctly, you can choose this option.

    • Forward All Query Strings: In situations where query strings play a significant role in tailoring content delivery, selecting this option ensures that all query string parameters are forwarded to your origin.

    • Forward Query Strings I Specify: If you want precise control over which query string parameters affect the content delivered from your origin, choose this option.

You've successfully configured a cache behavior for your FlashEdge distribution. Repeat these steps to add more cache behaviors or modify existing ones as needed.

Last updated