简体   繁体   English

如何在 Typo3 v8 上使用子域设置自己的 CDN?

[英]How to set up own CDN with subdomain on Typo3 v8?

As Content Replacer (ja_replacer) is not supported by Typo3 v8 is there any other way to replace url strings in Typo3 v8 and setup own CDN Service?由于 Typo3 v8 不支持Content Replacer (ja_replacer) ,有没有其他方法可以替换 Typo3 v8 中的 url 字符串并设置自己的 CDN 服务?

To make it more clear, in Typo3 v4.5-6.1 it would look like that:为了更清楚,在 Typo3 v4.5-6.1 中它看起来像这样:

config.tx_ja_replacer {
  search {
    1="typo3temp/
    2="fileadmin/
    3="typo3conf/
  }
  replace {
    1="https://cdn.domain.de/typo3temp/
    2="https://cdn.domain.de/fileadmin/
    3="https://cdn.domain.de/typo3conf/
  }
}

But this extension is not supported anymore.但是不再支持此扩展名。

Thanks in advance!提前致谢!

---- EDIT 1 ---- ---- 编辑 1 ----

If someone is still interested in 'ja_replacer', this is a Typo3 v7 & v8 Fork: ja_replace for Typo3 v7-8如果有人仍然对 'ja_replacer' 感兴趣,这是 Typo3 v7 & v8 Fork: ja_replace for Typo3 v7-8

With this I managed it to work but encountered CORS problems even if fonts where set to wildcard origins有了这个,我设法让它工作但遇到了 CORS 问题,即使字体设置为通配符来源

---- EDIT 2 ---- ---- 编辑 2 ----

Testes this (by Mario Naether) but this also did not worked (even with page.stdWrap.replacement)测试这个(由 Mario Naether 提供)但这也不起作用(即使使用 page.stdWrap.replacement)

page.stdWrap.replacement {
  10.search = #"fileadmin\/#
  10.replace = "https://cdn.domain.de/fileadmin/
  10.useRegExp = 1
  11.search = #"typo3temp\/#
  11.replace = "https://cdn.domain.de/typo3temp/
  11.useRegExp = 1
  12.search = #"typo3conf\/#
  12.replace = "https://cdn.domain.de/typo3conf/
  12.useRegExp = 1
}

---- EDIT 3 ---- ---- 编辑 3 ----

Finaly I found a solution which satisfies me.最后我找到了一个让我满意的解决方案。 (if I'm logged in) I posted it here as answer. (如果我已登录)我将其发布在这里作为答案。

This is actually working.. but not if I'm not logged in... So now I have to manage it to work even if I load the Website without beeing logged in.这实际上是有效的......但如果我没有登录就不行......所以现在我必须管理它才能工作,即使我在没有登录的情况下加载网站。

You can used the stdWrap function from TYPO3.您可以使用 TYPO3 中的 stdWrap 函数。 This works with all TYPO3 versions >= 6.2.这适用于所有 TYPO3 版本 >= 6.2。

page.stdWrap.replacement {
    10.search = #"fileadmin\/_processed_\/#
    10.replace = "https://cdn.mydoamin.de/fileadmin/_processed_/
    10.useRegExp = 1
}

Soooo after some days of research I found a good solution which is working with Typo3 v7.6.0 - v8.99.99 Soooo 经过几天的研究,我找到了一个很好的解决方案,它适用于 Typo3 v7.6.0 - v8.99.99

Install ja-replacer (by PHORAX)安装ja-replacer (by PHORAX)

and add this Code to your TypoScript并将此代码添加到您的 TypoScript

#CDN über Sub-Domain 'CDN.DOMAIN.de'
config.tx_ja_replacer{
  search {
    10="/typo3temp/
    11="typo3temp/
    12="/fileadmin/
    13="fileadmin/
    14="/typo3conf/
    15="typo3conf/
  }

  replace {
    10="https://CDN.DOMAIN.de/typo3temp/
    11="https://CDN.DOMAIN.de/typo3temp/
    12="https://CDN.DOMAIN.de/fileadmin/
    13="https://CDN.DOMAIN.de/fileadmin/
    14="https://CDN.DOMAIN.de/typo3conf/
    15="https://CDN.DOMAIN.de/typo3conf/
  }
}

#Domain-replace Setup für CDN
[globalString = ENV:HTTP_HOST = WWW.DOMAIN.de]
  page.config.baseURL = https://WWW.DOMAIN.de/
  config.tx_ja_replacer.replace < tx_ja_replacer
[global]

1.) Now replace every " cdn.domain.de " with your own CDN-Subdomain or CDN-Domain 1.) 现在用您自己的 CDN-Subdomain 或 CDN-Domain 替换每个“ cdn.domain.de

2.) replace every " www.domain.de " to your Domain. 2.) 将每个“ www.domain.de ”替换为您的域。

2b) if necessary change the value of " page.config.baseURL " to just http and not https if your not using https 2b) 如有必要,如果您不使用 https,请将“ page.config.baseURL ”的值更改为 http 而不是 https

---- EDIT 1 ---- ---- 编辑 1 ----

Somehow this is just working fine as long as I'm logged in. When I load my Typo3 Website without beeing logged in it does not replace anything.不知何故,只要我登录就可以正常工作。当我加载我的 Typo3 网站而没有登录时,它不会替换任何内容。

TYPO3 extension replacecontent from Michiel Roos, MaxServ has nearly the same functionality. TYPO3 扩展替换了 Michiel Roos 的内容,MaxServ 具有几乎相同的功能。 https://extensions.typo3.org/extension/replacecontent/ Current version is still only compatible with TYPO3 7.6, but it can easily been made TYPO3 8 compatible, while fork on github https://github.com/MaxServ/t3ext-replacecontent and improve existing code. https://extensions.typo3.org/extension/replacecontent/当前版本仍然只兼容TYPO3 7.6,但很容易兼容TYPO3 8,同时在github上fork https://github.com/MaxServ/t3ext-替换内容并改进现有代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM