Feature #37639

Allow overwriting the resource base uri

Added by Adrian Föder over 9 years ago. Updated over 9 years ago.

Status:
Rejected
Priority:
Could have
Category:
Resource
Start date:
2012-05-31
Due date:
% Done:

0%

Estimated time:
PHP Version:
Has patch:
No
Complexity:

Description

currently, the resourcesBaseUri is assumed from the current request (Resource\Publishing\FileSystemPublishingTarget::detectResourcesBaseUri()).
This makes every resource URI looking like this:

http://www.acme.com/_Resources/Persistent/cff1839e83120f9a4d711dde511ca09fbb562005.js

It would be nice to have an additional setting like

TYPO3:
  FLOW3:
    resource:
      publishing:
        overruleBaseDomain: 'cdn.acme.net'

Having set only this, the resource URI will look like the following:

http://cdn.acme.net/_Resources/Persistent/cff1839e83120f9a4d711dde511ca09fbb562005.js

In addition, overruleBaseSubdirectory is possible:

      publishing:
        overruleBaseDomain: 'cdn.acme.net'
        overruleBaseSubdirectory: 'ResourceStorage/WebResources/'

will result into

http://cdn.acme.net/ResourceStorage/WebResources/Persistent/cff1839e83120f9a4d711dde511ca09fbb562005.js

Setting

        overruleBaseSubdirectory: ''

http://cdn.acme.net/Persistent/cff1839e83120f9a4d711dde511ca09fbb562005.js

(in order to get rid of the '_Resources' subdirectory).

I'd say that overruleBaseSubdirectory is only possible/allowed to set if overruleBaseDomain is set.

Of course an alternative to overruleBaseSubdirectory is to introduce baseSubdirectory which is per default active and set to '_Resources' (this would change

    public function initializeObject() {
        if ($this->resourcesPublishingPath === NULL) {
            // $this->resourcesPublishingPath = FLOW3_PATH_WEB . '_Resources/';
            $this->resourcesPublishingPath = FLOW3_PATH_WEB . $this->settings['resource']['publishing']['baseSubdirectory'];
        }

To also have an option to get rid of the Static/ and Persistent/ subdirectories, the same configuration rules can go for these, for example:

      publishing:
        overruleBaseDomain: 'cdn.acme.net'
        overruleBaseSubdirectory: 'ResourceStorage/WebResources/'
        overruleStaticBaseDomain: 'static.cdn.acme.net'
        overruleStaticBaseSubdirectory: ''
        overrulePersistentBaseDomain: 'persistent.cdn.acme.net'
        overrulePersistentBaseSubdirectory: ''

An important clarification: all of this only affects the Web representation, i.e. what is outputted to the frontend in order to get an HTTP URI. The storage/symlink creation location does not change in any way.
Changing these settings are intended to require a setup in the rewrite rules, for example, because the actual storage on the file system isn't affected.

#1

Updated by Sebastian Kurfuerst over 9 years ago

-1, CDN support should rather be implemented using custom ResourcePublishers.

#2

Updated by Karsten Dambekalns over 9 years ago

  • Status changed from New to Rejected
  • Assignee set to Karsten Dambekalns

The point of resource publishers is to support those things. So instead of "misusing" the filesystem publisher, a CDN publisher should be created. Then this is not needed.

Also available in: Atom PDF