Skip to content

SSI include runs via php (index.php), instead of virtual including it via NGINX #875

@holiday-jan

Description

@holiday-jan

Bug Report

When we're using SSI includes in a multi language site setup (1 domain, multiple language directories), the SSI virtual include is not included via NGINX, but runs via the PHP index.php process, so it's not using the NGINX-rewrites.

I think i found the problem:

  • virtual include in generated index.html:
    <!--#include virtual="/nl/_cached_include_1578965506?p=nl/_cached_include_1578965506" -->

  • cached_include file in blitz-cache directory
    /nl/_cached_include_1578965506/p=_cached_include_1578965506/index.html

So in the args section of the url, it's missing the [lng]/ part.

From the CraftCP Blitz "Tracked Includes" section, it's shown without the [lng]/ part:

  • /nl/_cached_include_1578965506?p=_cached_include_1578965506, this works fast, < 10ms via NGINX rewrite

In the website it runs via PHP's index.php, as the virtual includes shows in generated index.html:

  • /nl/_cached_include_1578965506?p=nl/_cached_include_1578965506, it's slower, between 100ms and 250ms

Am I missing anything configuration wise in my NGINX-host (same as configuration with $args), or in Blitz itself? (not meaning the PHP-rewrite option)

Extra info, on a staging setup, with the multi language site and unique domains per language (so no language dirs), it works perfectly. So i think it's a bug, but i'm not entirely sure.

Thank you for your time!
Best regards, Jan

Diagnostics Report

Application Info

  • PHP version: 8.3.6
  • Craft edition & version: Pro 5.9.14
  • Database driver & version: MySQL 31.1

Installed Plugins

  • Blitz: 5.12.7
  • CKEditor: 4.11.1
  • Control Panel Nav: 5.0.5
  • Element API: 4.2.0
  • HolidayAgent: 5.5.2
  • HolidayCMS: 5.7.1
  • HolidayCMS SSO: 5.1.0
  • Maps: 5.0.4
  • oEmbed: 3.2.0
  • Retour: 5.0.14
  • SEOmatic: 5.1.20
  • Wheel Form: 4.0.4

Loaded Modules

  • codeeditor: nystudio107\codeeditor\CodeEditor
  • sprig-core: putyourlightson\sprig\Sprig
  • verbb-base: verbb\base\Base

Blitz Plugin Settings

{
    "debug": false,
    "hintsEnabled": false,
    "cachingEnabled": true,
    "refreshCacheEnabled": true,
    "refreshMode": 1,
    "includedUriPatterns": [
        {
            "enabled": true,
            "siteId": "",
            "uriPattern": ".*"
        }
    ],
    "excludedUriPatterns": [],
    "cacheStorageType": "putyourlightson\\blitz\\drivers\\storage\\FileStorage",
    "cacheStorageSettings": [],
    "cacheStorageTypes": [],
    "cacheGeneratorType": "putyourlightson\\blitz\\drivers\\generators\\HttpGenerator",
    "cacheGeneratorSettings": {
        "concurrency": 2
    },
    "cacheGeneratorTypes": [],
    "customSiteUris": [],
    "cachePurgerType": "putyourlightson\\blitz\\drivers\\purgers\\DummyPurger",
    "cachePurgerSettings": [],
    "cachePurgerTypes": [],
    "deployerType": "putyourlightson\\blitz\\drivers\\deployers\\DummyDeployer",
    "deployerSettings": [],
    "deployerTypes": [],
    "ssiEnabled": true,
    "ssiTagFormat": "<!--#include virtual=\"{uri}\" -->",
    "detectSsiEnabled": true,
    "esiEnabled": false,
    "cachedIncludePathParam": "p",
    "onlyCacheLowercaseUris": false,
    "cacheActionRequests": false,
    "queryStringCaching": 1,
    "includedQueryStringParams": [],
    "excludedQueryStringParams": [
        {
            "enabled": true,
            "siteId": "",
            "queryStringParam": "booking_*"
        },
        {
            "enabled": true,
            "siteId": "",
            "queryStringParam": "search"
        },
        {
            "enabled": true,
            "siteId": "",
            "queryStringParam": "gclid"
        },
        {
            "enabled": true,
            "siteId": "",
            "queryStringParam": "fbclid"
        },
        {
            "enabled": true,
            "siteId": "",
            "queryStringParam": "_gl"
        },
        {
            "enabled": true,
            "siteId": "",
            "queryStringParam": "gtm_debug"
        },
        {
            "enabled": true,
            "siteId": "",
            "queryStringParam": "utm_.*"
        },
        {
            "enabled": true,
            "siteId": "",
            "queryStringParam": "gad_source"
        },
        {
            "enabled": true,
            "siteId": "",
            "queryStringParam": "gbraid"
        }
    ],
    "apiKey": "",
    "generatePagesWithQueryStringParams": true,
    "purgeAssetImagesWhenChanged": true,
    "refreshCacheAutomaticallyForGlobals": false,
    "refreshCacheWhenElementMovedInStructure": true,
    "refreshCacheWhenElementSavedUnchanged": false,
    "refreshCacheWhenElementSavedNotLive": false,
    "refreshExpiredCacheAfterVisit": true,
    "cacheNonHtmlResponses": false,
    "trackElements": true,
    "trackElementQueries": true,
    "excludedTrackedElementQueryParams": [],
    "cacheDuration": null,
    "nonCacheableElementTypes": [],
    "sourceIdAttributes": [],
    "liveStatuses": [],
    "integrations": [
        "putyourlightson\\blitz\\drivers\\integrations\\CommerceIntegration",
        "putyourlightson\\blitz\\drivers\\integrations\\DatastarIntegration",
        "putyourlightson\\blitz\\drivers\\integrations\\SeomaticIntegration"
    ],
    "defaultCacheControlHeader": "no-store",
    "cacheControlHeader": "public, s-maxage=31536000, max-age=0",
    "cacheControlHeaderExpired": "public, s-maxage=5, max-age=0",
    "sendPoweredByHeader": true,
    "outputComments": true,
    "refreshCacheJobPriority": 10,
    "driverJobBatchSize": 50,
    "driverJobPriority": 100,
    "queueJobTtr": 600,
    "maxRetryAttempts": 10,
    "maxUriLength": 2048,
    "maxUriIndexLength": 767,
    "mutexTimeout": 1,
    "commands": [],
    "injectScriptEvent": "DOMContentLoaded",
    "injectScriptPosition": 3
}

Recommendations

  • ✅ Blitz is configured not to refresh cached pages when an element is saved but unchanged.
  • ✅ Blitz is configured not to refresh cached pages when an element is saved but not live.
  • ✅ Image transforms are configured to be generated before page load.
  • ✅ One or more globals exist and refreshCacheAutomaticallyForGlobals is disabled.
  • ✅ The @web alias is explicitly defined.
  • ✅ Queue jobs are configured not to run automatically via web requests.
  • ✅ The Async Queue plugin is not installed or enabled.
  • ✅ The blitz/cache/refresh-expired console command has been executed within the past 24 hours.

Site Tracking [1]

  • Tracked Pages: 70
  • Tracked Includes: 18
  • Tracked Actions: 0
  • Tracked Query String Params: 0
  • Tracked Elements: 987
    • craft\elements\Entry: 369
    • craft\elements\Entry (nested): 363
    • craft\elements\Asset: 244
    • craft\elements\Category: 9
    • craft\elements\User: 2
  • Tracked Element Queries: 90
    • craft\elements\Entry: 85
    • craft\elements\User: 4
    • craft\elements\Category: 1
  • Tracked Tags: 0

Site Tracking [2]

  • Tracked Pages: 3
  • Tracked Includes: 6
  • Tracked Actions: 0
  • Tracked Query String Params: 0
  • Tracked Elements: 374
    • craft\elements\Asset: 143
    • craft\elements\Entry: 143
    • craft\elements\Entry (nested): 78
    • craft\elements\Category: 9
    • craft\elements\User: 1
  • Tracked Element Queries: 58
    • craft\elements\Entry: 56
    • craft\elements\Category: 1
    • craft\elements\User: 1
  • Tracked Tags: 0

Site Tracking [7]

  • Tracked Pages: 7
  • Tracked Includes: 6
  • Tracked Actions: 0
  • Tracked Query String Params: 0
  • Tracked Elements: 408
    • craft\elements\Asset: 153
    • craft\elements\Entry: 152
    • craft\elements\Entry (nested): 93
    • craft\elements\Category: 9
    • craft\elements\User: 1
  • Tracked Element Queries: 60
    • craft\elements\Entry: 57
    • craft\elements\User: 2
    • craft\elements\Category: 1
  • Tracked Tags: 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions