All Products
Search
Document Center

Edge Security Acceleration:Rewrite URLs

Last Updated:Sep 27, 2024

If the storage path of resources on your origin server changes but you want users to use the original URL to access the resources, you can use the URL rewrite feature to rewrite the URL on Edge Security Acceleration (ESA) points of presence (POPs). ESA allows you to rewrite the URL path and query string in requests before they are redirected to origin servers.

Note

The URL rewrite feature does not affect the internal links or cache keys of ESA. This feature allows only ESA POPs to access origin servers with rewritten URLs.

Examples

Example 1: Rewrite only the URL path

1

Example 2: Rewrite the URL path and query string

2

Create a URL rewrite rule

  1. Log on to the ESA console.

  2. In the left-side navigation pane, click Websites.

  3. On the Websites page, find the website that you want to manage, and click the website name or View Details in the Actions column.

  4. In the left-side navigation tree, choose Rules > Transform Rules.

  5. Click the Rewrite URL tab.

  6. Click Create Rule. On the page that appears, enter a rule name in the Rule Name field.

  7. In the If requests match... section, specify the conditions for matching incoming requests. In the Rewrite URL section, configure the Path and Query String parameters.

    Rewrite object

    Operation

    Description

    Example

    Path

    Retain

    Retains the path in the original request.

    -

    Rewrite to...

    Replaces the path in the original request with the destination path.

    Note

    Only the static rewrite method is supported. You can specify only a string for this parameter.

    If the original URL is https://example.com/examplefile.png

    and you specify /image/example.png for this parameter,

    the rewritten origin URL is https://example.com/image/example.png.

    Query String

    Retain

    Retains the query string in the original request.

    -

    Rewrite to...

    Replaces the query string in the original request with the destination query string.

    Note

    Only the static rewrite method is supported. You can specify only a string for this parameter.

    If the original URL is https://example.com/examplefile.png?code=123

    and you specify code=321 for this parameter,

    the rewritten origin URL is https://example.com/examplefile.png?code=321.

  8. Click OK.