Bug #85945

AdminPanel: Missing absRefPrefix on cached requests

Added by Daniel Haupt 10 months ago. Updated 27 days ago.

Status:
Under Review
Priority:
Must have
Assignee:
-
Category:
AdminPanel
Start date:
2018-08-23
Due date:
% Done:

0%

TYPO3 Version:
8
PHP Version:
7.1
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I use only config.absRefPrefix=1 in my TYPO3 instance without setting any baseUrl. Also, I'm using the extension CoolUri for speaking URLs (without speaking URLs this issue doesn't appear).

This leads to the error that the admin panel is not displayed on cached requests, as the line which sets e.g. the JavaScript resource URL

$frontendPathExtBackend = htmlspecialchars($this->getTypoScriptFrontendController()->absRefPrefix) . ExtensionManagementUtility::siteRelPath('backend');
tries to use the absRefPrefix set in TypoScriptFrontendController, which is only set correctly in uncached requests where the page gets generated.

So using the admin panel in development mode works fine while using it in production mode does not because all resources (JS and CSS) are missing the "/" of the absRefPrefix.

And again: This issue only applies to instances with speaking URLs and without defining a base URL.

Because of the rewrite of the admin panel in v9, I'm not sure if the issue will still exist over there.

History

#1 Updated by Daniel Haupt 10 months ago

A fix I've just got in mind would be to use $GLOBALS['TSFE']->config['config']['absRefPrefix'] instead of $this->getTypoScriptFrontendController()->absRefPrefix or to generally set $this->getTypoScriptFrontendController()->absRefPrefix for every request.

I like the first idea more as not every requests needs the admin panel.

#2 Updated by Susanne Moog 10 months ago

  • Target version changed from 8.7.19 to Candidate for patchlevel

#3 Updated by Daniel Haupt 5 months ago

If anyone else ever runs into this, here is our XClass workaround we've been using temporarily to always set the absRefPrefix for cached and uncached requests.

class AdminPanelView extends \TYPO3\CMS\Frontend\View\AdminPanelView
{
    public function display()
    {
        // This verifies that absRefPrefix is set correctly (https://forge.typo3.org/issues/85945)
        $this->getTypoScriptFrontendController()->preparePageContentGeneration();

        return parent::display();
    }

}

Moving our projects to v9, this workaround is not necessary anymore so I could live with closing this issue now.

#4 Updated by Gerrit Code Review 27 days ago

  • Status changed from New to Under Review

Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60833

Also available in: Atom PDF