DEPRECATION WARNING
This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.
EXT: Readable name of your extension¶
Created: | 2010-02-18T17:33:18 |
---|---|
Changed by: | Fernando |
Changed: | 2010-02-24T17:53:42 |
Classification: | extensionkey |
Description: | The keywords help with categorizing and tagging of the manuals. You can combine two or more keywords and add additional keywords yourself. Please use at least one keyword from both lists. If your manual is NOT in english, see next tab "language" ---- forEditors (use this for editors / german "Redakteure") forAdmins (use this for Administrators) forDevelopers (use this for Developers) forBeginners (manuals covering TYPO3 basics) forIntermediates (manuals going into more depth) forAdvanced (covering the most advanced TYPO3 topics) see more: http://wiki.typo3.org/doc_template#tags ---- |
Keywords: | keywords comma-separated |
Author: | Author Name |
Email: | your@email.com |
Info 4: | |
Language: | en |
EXT: Readable name of your extension - extensionkey
EXT: Replace local files with CDN files¶
Extension Key: cdnfiles
Language: en
Keywords: cdn,replace,frontend,files
Copyright 2000-2010, Fernando Arconada, <fernando.arconada@gmail.com>
This document is published under the Open Content License
available from http://www.opencontent.org/opl.shtml
The content of this document is related to TYPO3
- a GNU/GPL CMS/Framework available from www.typo3.org
Table of Contents¶
EXT: Replace local files with CDN files 1
`Introduction 3 <#1.1.Introduction|outline>`_
`Users manual 5 <#1.2.Users%20manual|outline>`_
`Administration 6 <#1.3.Administration|outline>`_
`Configuration 7 <#1.4.Configuration|outline>`_
`Known problems 8 <#1.5.Known%20problems|outline>`_
`To-Do list 9 <#1.6.To-Do%20list|outline>`_
`ChangeLog 10 <#1.7.ChangeLog|outline>`_
Introduction¶
What does it do?¶
This extension replaces local file references in the html page with references to remote files. With this change you could easy scale your web application so you could distribute the charge of downloading resources from your server and you could serve them from a Content Delivery Network like Amazon CloudWatch. This extension mostly, it is a hook that reads the html before send it to the user and then replaces the file strings, this extension doesnt upload the content to any kind of server cause i think that this should be an architectural task that you could solve with a scheduled task (rsync or similar) or mounting the remote filesystem as it is a local one.
Screenshots¶
Just install, configure and go.
Users manual¶
- Install the extension from TER or TYPO3 forge
- Configure the extension:
- Clean the cache
- Ready
Configuration¶
The configuration is splited in 3 parts, one for each TYPO3 files directory related with FE: fileadmin/ uploads/ and typo3temp/pics/
Each part of the configuration has the following parameters (this explanation it is for fileadmin):
replace_fileadmin_directory: should I replace file references for files in fileadmin/ directory?
fileadmin_regexp: to match the fileadmin/ directory a regular expression it is used and evaluated case insensitive. You could use regular expression variables using () then $1 is used instead of the whole match. The regular expression, internally, adds quotes to your expression to locate only quoted file references
fileadmin_urlprefix: an URL in the CDN should have the form [prefix in the CDN] + [same path as in you local server] i.e. http://mybucket.s3.amazon.com/fileadmin/mydir/myphoto.jpg
remove_fileadmin_directory: in many cases you will want to remove file fileadmin/ directory cause it is the document root of your CDN server.
advancedconfig_file: this parameter is common for all directories and should be located under site path and written in YAML format. http://components.symfony-project.org/yaml/trunk/book/02-YAML
The configuration section has 2 sections files and patterns. files section has priority over patterns section. With this configuration file you could add exceptions to the global replacement policy. Example of the file:
## YAML CDN configuration file
patterns:
#any valid regular expression in PCRE format
'(fileadmin/[^"]*.css)':
# prefix to apply if i found this regular expression
#it isnt necesary if replace: false
cdn_prefix: " `http://a0.twimg.com/a/1266605807/images/ <http://a0.twimg.com/a/1266605807/images/>`_ "
#if i founf that regular expression, should i replace the file or leave as it is.
replace: false
files:
#could be a exact file or a regular expression in PCRE format
"jquery-1.3.2.min.js":
#it isnt necesary if replace: false
# by default replace is always false
replace: true
#In the files section i dont use the pattern [CDN prefix]+[file path]
#I just replace all the file reference with the string in cdn_url
cdn_url: http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js
"typo3temp/pics/3a5338c306.jpg":
replace: false
FAQ¶
Possible subsections: FAQ
Known problems¶
The extension could find file references inside regular text
To-Do list¶
- Don't do any replacement if some content in the page where updated less than X seconds agoç
- Verify that the file reference is found inside a HTML tag not only in a quoted string