How to Set Up Page Rules on VergeCloud for Website Optimization and Control

Configuring Page Rules on VergeCloud: Optimize and Control Your Website’s Performance

VergeCloud Page Rules

Page Rules allow you to customize and optimize your domain’s behavior within VergeCloud’s CDN. By leveraging Page Rules, you can enhance performance, security, and resource management for specific URLs, creating a tailored experience for your website’s visitors.

Core Concepts Glossary

  • Cache: Temporarily stores data to reduce load times and server strain.
  • Page Rule: A customizable set of conditions and actions applied to specific URLs.
  • Redirect: Automatically guide users from one URL to another while maintaining SEO integrity.
  • Timeout: The maximum time allowed for a request or connection to complete.
  • Headers: Metadata sent with HTTP requests and responses to control browser or server behavior.

How Page Rule Priorities Work

Page Rules are executed based on their priority order, with rules at the top of the list taking precedence over those below. Only the first matching rule is applied to a request. For effective rule management:

  • Ensure high-priority rules are placed at the top of the list.
  • Combine settings into a single rule whenever possible to avoid conflicts.
  • Use specific URL patterns to precisely target the intended pages.

Example: If you have a rule to cache https://example.com/images/* and another to disable caching for https://example.com/images/logo.png, the latter should be placed higher in the list to take priority.

Features

VergeCloud Page Rules offer a wide range of features to optimize and customize your domain. Below is a detailed guide to each feature.

Cache Settings

Description: Control how VergeCloud caches content for your domain. Cache settings include device-specific caching and origin cache control.

  • URL Pattern: Define the URL to apply the rule (e.g., https://example.com/images/*).
  • Cache TTL: Set the cache duration (in seconds).
  • Device Type Cache: Enable caching based on device type (e.g., mobile, desktop).

Steps to Configure:

  1. Navigate to the Page Rules section in your VergeCloud panel.
  2. Click Create Page Rule and enter the URL pattern.
  3. Set the Cache TTL and enable Device Type Cache if required.
  4. Save the rule to apply the changes.

Redirect

Description: Set up HTTP redirects (e.g., 301, 302) to guide users from one URL to another.

  • URL Pattern: Define the URL for redirection (e.g., https://example.com/old-page).
  • Redirect Target: Specify the destination URL.
  • Redirect Type: Choose between 301 (permanent) or 302 (temporary).

Steps to Configure:

  1. Go to the Page Rules section in VergeCloud.
  2. Select Redirect as the action for your rule.
  3. Enter the URL Pattern, Redirect Target, and Redirect Type.
  4. Save the rule.

Browser Cache

Description: Control how long browsers cache static content to improve performance.

  • URL Pattern: Specify the URL (e.g., https://example.com/assets/*).
  • Browser Cache TTL: Set the duration (in seconds) for browser caching.

Steps to Configure:

  1. Open the Page Rules section in VergeCloud.
  2. Add a new rule and select Browser Cache as the action.
  3. Set the Browser Cache TTL.
  4. Save your changes.

Origin Cache Control

Description: Honor the cache settings defined by your origin server using the Cache-Control and Expires headers.

  • URL Pattern: Define the URL scope for this rule.

Steps to Configure:

  1. Navigate to the Page Rules section.
  2. Create a rule and select Origin Cache Control.
  3. Enter the URL Pattern.
  4. Save the rule.

Timeout Settings

Description: Customize the timeout settings for connection, read, and write operations between VergeCloud’s edge servers and your origin.

  • Connection Timeout: Maximum time (in seconds) to establish a connection.
  • Read Timeout: Time to wait for a response from the origin server.
  • Write Timeout: Time to wait for the origin server to acknowledge data sent.

Steps to Configure:

  1. Access Page Rules in VergeCloud.
  2. Create a rule and select Timeout Settings.
  3. Enter values for Connection Timeout, Read Timeout, and Write Timeout.
  4. Save the rule.

Send Traffic to Load Balancer

Description: Direct traffic for specific URLs to a configured load balancer for high availability and performance optimization.

  • URL Pattern: Specify the URL to direct traffic (e.g., https://example.com/api/*).
  • Load Balancer: Select the configured load balancer to handle traffic.

Steps to Configure:

  1. Go to Page Rules in VergeCloud.
  2. Create a rule and select Send Traffic to Load Balancer.
  3. Enter the URL pattern and choose the load balancer.
  4. Save the rule.

Ignore User Response Header

Description: Override response headers sent by the origin server with VergeCloud-specific settings.

  • URL Pattern: Define the URL scope for this rule.

Steps to Configure:

  1. Navigate to Page Rules in VergeCloud.
  2. Create a rule and select Ignore User Response Header.
  3. Enter the URL Pattern.
  4. Save the rule.

Custom Host Header

Description: Define a custom host header to send to your origin server for specific URLs.

  • URL Pattern: Specify the URL scope.
  • Host Header: Enter the custom host header value.

Steps to Configure:

  1. Access the Page Rules section.
  2. Create a rule and select Custom Host Header.
  3. Enter the URL Pattern and the custom host header value.
  4. Save the rule.

Cache by Device Type

Description: Cache by Device Type creates separate caching rules for desktop, tablet, and mobile devices, ensuring content delivery is optimized for each device.

  • URL Pattern: Specify the URL scope (e.g., https://example.com/*).

Steps to Configure:

  1. Go to the Page Rules section in VergeCloud.
  2. Click Create Page Rule and enter the URL pattern.
  3. Save the rule to apply changes.

Description: Secure Link restricts content access using token-based authentication, ensuring only authorized users can view protected resources.

  • URL Pattern: Define the URL scope (e.g., https://example.com/secure/*).
  • Token Validation Endpoint: Specify the endpoint to validate authentication tokens.
  • Expiration Time: Set the token validity duration.

Steps to Configure:

  1. Navigate to the Page Rules section in VergeCloud.
  2. Create a new rule and enter the URL Pattern.
  3. Enable Secure Link and set the validation endpoint and expiration time.
  4. Save the rule.

Web Boost

Description: Web Boost enhances website performance by optimizing static files, such as CSS, JavaScript, and images, on the fly.

  • URL Pattern: Specify the URLs for optimization (e.g., https://example.com/*).
  • Optimization Level: Select the level of optimization (e.g., basic, advanced).

Steps to Configure:

  1. Go to the Page Rules section in VergeCloud.
  2. Click Create Page Rule and enter the URL Pattern.
  3. Select Web Boost and configure the optimization level.
  4. Save the rule.

Image Resize

Description: Dynamically resize images based on user-defined dimensions and resolutions to enhance load times and improve compatibility across devices.

  • URL Pattern: Define the scope for resizing images (e.g., https://example.com/images/*).
  • Width/Height: Set the desired dimensions of images.
  • Resolution: Select the resolution (e.g., 1x, 2x for retina displays).

Steps to Configure:

  1. Navigate to the Page Rules section in VergeCloud.
  2. Click Create Page Rule and specify the URL Pattern.
  3. Select Image Resize and configure the dimensions and resolution.
  4. Save the rule.

Origin Request Headers

Description: Add or modify HTTP headers sent to the origin server for specific requests, ensuring proper behavior and customization for each rule.

  • URL Pattern: Define the scope of the rule (e.g., https://example.com/api/*).
  • Headers: Add custom headers as key-value pairs.

Steps to Configure:

  1. Open the Page Rules section in VergeCloud.
  2. Create a new rule and enter the URL Pattern.
  3. Select Origin Request Headers and add headers as key-value pairs.
  4. Save the rule.

Considerations

  • Rule Priority: Page Rules are applied in the order of priority. Only the first matching rule is applied. Ensure more specific rules are placed higher in the list than general ones to avoid conflicts.
  • Cache Behavior:
    • HTML content is not cached by default. If you want to cache HTML files, you must use wildcards in the path (e.g., /test/*).
    • If both Origin Cache Control and VergeCloud Cache Settings are enabled, the Origin Cache-Control headers will take precedence.
    • Separate page rules are required to cache the root page (e.g., `/`).
  • Device-Specific Caching: When enabling "Cache by Device Type," ensure that the content is optimized for each device type (e.g., mobile, tablet, desktop) to avoid inconsistencies.
  • Redirects: Use 301 redirects for permanent changes to URLs to retain SEO rankings and 302 for temporary redirections.
  • Timeout Settings: Properly configure connection, read, and write timeouts to avoid unnecessary delays or dropped connections during heavy traffic periods.
  • Image Resize: Ensure original images are large enough to accommodate resizing without quality loss. Always test resized images for compatibility across devices.
  • Web Boost: Choose an optimization level (e.g., basic or advanced) that does not affect the functionality of your website's scripts and styles.
  • Secure Link: Tokens should have a clearly defined expiration time to prevent unauthorized access. Ensure the token validation endpoint is highly secure and reliable.
  • Origin Request Headers: Custom headers should not conflict with existing ones sent by the browser or server. Use unique header names where possible.
  • Ignore User Response Header: Be cautious when overriding headers sent by the origin server to ensure expected behavior for caching, security, or functionality is not disrupted.
  • Custom Host Header: Ensure that custom host headers align with the origin server's requirements and configuration.
  • Send Traffic to Load Balancer: Verify that the load balancer is properly configured and healthy to handle traffic directed by this rule.
  • Testing: After creating or updating rules:
    • Use tools like curl or browser developer tools to verify headers, caching, redirects, and other configurations.
    • Use dig to confirm DNS settings where applicable.