Skip to main content

Browser Cache Rule

This setting is available in small, large and dynamic(aksela) resource types.

 Parameters

 Description

 Type

 Required

organization_uuid

The created organization in Medianova Cloud Panel unit ID value. Path parameter.

String

Yes

resource_uuid

The created resource in Medianova Cloud Panel unit ID value. Path parameter.

String

Yes

browser_cache_rules

A maximum of 15 rules can be defined.

Array

Yes

browser_cache_rules.type

This parameter takes one of the values “all_files”, “full_path”, “directory”, “file_extension”.

String

Yes

browser_cache_rules.content

If browser_cache_rules.type is “full_path” or “directory” or “file_extension”, browser_cache_rules.content is required.

If If browser_cache_rules.type is all_files, browser_cache_rules.content must be empty.

  • The total length of characters entered in this parameter must be maximum 255.

  • The limit of this parameter is max 20.

Array

Yes

browser_cache_rules.priority

You can enter between 1-100. The priority order is from most to least.

The browser_cache_rules.0.priority field is required unless browser_cache_rules.0.is_delete is in true.

Integer

Yes

browser_cache_rules.cache_mode

This parameter takes one of the values “origin”, “cache”, “no_cache”.

  • origin: It transmits using the information coming from the origin side.

  • cache: Action is taken according to the given cache time.

  • no-cache: It transmits in a way that does not cause cache.

String

Yes

browser_cache_rules.cache_time

Specifies the cache duration for requests made by the browser. In this way, when the time expires, the user requests the content again from the CDN. Entry is made in seconds.

Integer

No

browser_cache_rules.directive

Specifies Cache-Control header directives.

This parameter takes the values “must-revalidate”, “no-cache”, “no-store”, “no-transform”, “public”, “private”, “proxy-revalidate”

Array

No

browser_cache_rules.exact_match

If the entry type is Directory and a single directory information entry is provided, an exact match can be used.

If browser_cache_rules.type is directory, browser_cache_rules.exact_match is required.

Boolean

No

browser_cache_with_html

This parameter controls whether the browser caches HTML content. A value of 'true' enables caching, while 'false' disables it. This can impact the performance of web applications.

Boolean

No

browser_cache_rules.is_delete

True is sent to delete a specific rule.

There is an example in the second payload.

Boolean

No

Notes

Full Path:

  • It must start with “/”.

  • The “*” character can only be followed by the character “/”

  • It is limited to 255 characters. Cannot use ,;|:"\ characters.

Directory:

  • It starts with “/” and “,” to distinguish between directories. “,” cannot be used in the last directory entry, and “,” cannot be entered consecutively.

  • A maximum of 20 directory entries can be entered at a time.

  • The character length that can be entered is limited to 255 characters.

  • The “*” character, wildcard transaction, cannot be performed.

File Extension:

  • It starts with "." and the character “,” is used to distinguish between file formats. “,” cannot be used in the final file format entry, and “,” cannot be entered consecutively.

  • File formats can be entered at most 20 at a time.

  • The character length that can be entered is limited to 255 characters.

Payload

CODE
{
    "resource_uuid": "****-****-****-***",
    "browser_cache_rules": [
        {
            "type": "all_files",
            "content": [],
            "priority": 50,
            "cache_mode": "origin",
            "cache_time": 0,
            "directive": [],
            "exact_match": false
        },
        {
            "type": "full_path",
            "content": [
                "/example/images.jpg"
            ],
            "priority": 40,
            "cache_mode": "cache",
            "cache_time": 60,
            "directive": [
                "must-revalidate",
                "public",
                "private"
            ],
            "exact_match": false
        },
        {
            "type": "directory",
            "content": [
                "/test",
                "/test1/"
            ],
            "priority": 100,
            "cache_mode": "no_cache",
            "cache_time": 0,
            "directive": [],
            "exact_match": false
        },
        {
            "type": "file_extension",
            "content": [
                ".png",
                ".jpg"
            ],
            "priority": 30,
            "cache_mode": "cache",
            "cache_time": 30,
            "directive": [
                "must-revalidate",
                "no-cache",
                "no-store",
                "no-transform",
                "public",
                "private",
                "proxy-revalidate"
            ],
            "exact_match": false
        },
        {
            "type": "directory",
            "content": [
                "/sinem/"
            ],
            "priority": 30,
            "cache_mode": "cache",
            "cache_time": 30,
            "directive": [
                "must-revalidate",
                "no-cache",
                "no-store",
                "no-transform",
                "public",
                "private",
                "proxy-revalidate"
            ],
            "exact_match": true
        }
    ],
    "browser_cache_with_html": false
}

Payload - Delete Rule

CODE
{
    "resource_uuid": "****-*****-****-****",
    "browser_cache_rules": [
        {
            "id": 1,
            "type": "all_files",
            "content": [],
            "priority": 50,
            "cache_mode": "origin",
            "cache_time": 0,
            "directive": [],
            "exact_match": false,
            "is_delete": true
        },
        {
            "id": 2,
            "type": "full_path",
            "content": [
                "/example/images.jpg"
            ],
            "priority": 40,
            "cache_mode": "cache",
            "cache_time": 60,
            "directive": [
                "must-revalidate",
                "public",
                "private"
            ],
            "exact_match": false,
            "is_delete": false
        },
        {
            "id": 3,
            "type": "directory",
            "content": [
                "/test",
                "/test1/"
            ],
            "priority": 100,
            "cache_mode": "no_cache",
            "cache_time": 0,
            "directive": [],
            "exact_match": false,
            "is_delete": false
        },
        {
            "id": 4,
            "type": "file_extension",
            "content": [
                ".png",
                ".jpg"
            ],
            "priority": 30,
            "cache_mode": "cache",
            "cache_time": 30,
            "directive": [
                "must-revalidate",
                "no-cache",
                "no-store",
                "no-transform",
                "public",
                "private",
                "proxy-revalidate"
            ],
            "exact_match": false,
            "is_delete": false
        },
        {
            "id": 5,
            "type": "directory",
            "content": [
                "/sinem/"
            ],
            "priority": 30,
            "cache_mode": "cache",
            "cache_time": 30,
            "directive": [
                "must-revalidate",
                "no-cache",
                "no-store",
                "no-transform",
                "public",
                "private",
                "proxy-revalidate"
            ],
            "exact_match": true,
            "is_delete": false
        }
    ],
    "browser_cache_with_html": 0
}
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.