Rulesets

Often you need a certain set of rules in for different tested elements. For example, the security and performance rules should be equally shared across all tested pages. And thus it makes sense to define a set of rules, which you can apply to your resources. This makes it easier for you to maintain your default rules, as you do not have to paste them in each section.

To clarify this, let's have another look at an example:

defaults:
    target:
        port: 8080
        host: www.somehost.com
        scheme: http
        path: en/home


Sections:
    defaultwebsite:
        rulesets:
            - DefaultPageRules
        rules:
            - HttpRequestTime

    SomeImportantPage:
        target:
            path: some/important/path
        rulesets:
            - DefaultPageRules
            - SeoRules

Rulesets:
    DefaultPageRules:
        - HttpHeaderExposeLanguage
        - HttpHeaderXSSProtectionSecure
    SeoRules:
        - TitleTagLength
        - ExactlyOneH1TagPresent

Obviously, you can mix rules and rulesets directives per section. And also you can assign multiple rulesets to a section

The above example could be even more simplified:

defaults:
    target:
        port: 8080
        host: www.somehost.com
        scheme: http
        path: en/home

    rulesets:
        - DefaultPageRules

Sections:
    defaultwebsite:
        rules:
            - HttpRequestTime

    SomeImportantPage:
        target:
            path: some/important/path
        rulesets:
            - SeoRules

Rulesets:
    DefaultPageRules:
        - HttpHeaderExposeLanguage
        - HttpHeaderXSSProtectionSecure
    SeoRules:
        - TitleTagLength
        - ExactlyOneH1TagPresent

You can define default rulesets in the defaults section. But be aware, that these rulesets are assigned to all your resources and pages. This only rarely makes sense. But there might be some cases.