云中的 Dispatcher Dispatcher-in-the-cloud

简介 apache-and-dispatcher-configuration-and-testing

本页介绍了Dispatcher工具以及如何下载和提取它们,列出了支持的Apache模块,并提供了旧版和灵活模式的高级概述。 此外,还提供了有关验证、调试和将Dispatcher配置从AMS迁移到AEM as a Cloud Service的参考资料。

Dispatcher 工具 dispatcher-sdk

Dispatcher 工具是整个 AEM as a Cloud Service SDK 的一部分,并提供了:

  • 一种标准文件结构,其中包含要包含在Dispatcher的maven项目中的配置文件。
  • 要验证Dispatcher配置是否仅包含AEM as a Cloud Service支持的指令,请使用此工具。 此外,该工具还会验证语法是否正确,以便Apache能够成功启动。
  • 在本地启动Dispatcher的Docker图像。

下载并提取工具 extracting-the-sdk

可以从软件分发门户上的 zip 文件中下载 Dispatcher 工具(它是 AEM as a Cloud Service SDK 的一部分)。 新版本的 Dispatcher 工具中提供的任何新配置都可用于部署到运行该版本的 AEM 或更高版本的云环境。

解压 SDK,它捆绑了适用于 macOS、Linux® 和 Windows 的 Dispatcher 工具。

对于 macOS/Linux,使 Dispatcher 工具构件可执行并运行它。 它会将Dispatcher Tools文件提取到存储这些文件的目录中(其中version是Dispatcher Tools的版本)。

$ chmod +x aem-sdk-dispatcher-tools-<version>-unix.sh
$ ./aem-sdk-dispatcher-tools-<version>-unix.sh
Verifying archive integrity...  100%   All good.
Uncompressing aem-sdk-dispatcher-tools-<version>-unix.sh 100%

对于 Windows,提取 Dispatcher 工具 zip 存档。

使用 Dispatcher 工具进行验证和调试 validation-debug

Dispatcher 工具用于验证和调试项目的 Dispatcher 配置。 了解如何根据您项目的 Dispatcher 配置是在灵活架构还是旧版架构下构建的,在下面引用的页面中使用这些工具的更多信息:

  • 灵活模式 - AEM原型28及更高版本的推荐模式和默认值,Cloud Manager也将其用于Cloud Manager 2021.7.0版本之后创建的新环境。 客户可以通过添加文件夹和文件 opt-in/USE_SOURCES_DIRECTLY 来激活此架构。 对于这种更灵活的模式,在旧模式下需要单个rewrite.rules文件的rewrites文件夹下的文件结构没有限制。 此外,可添加的规则数量不受任何限制。 有关文件夹结构和本地验证的详细信息,请参阅使用 Dispatcher 工具进行验证和调试。

  • 旧模式 — 有关Dispatcher配置旧模式的文件夹结构和本地验证的详细信息,请参阅使用Dispatcher工具进行验证和调试(旧版)

有关如何从AEM原型28及更高版本提供的旧版配置模型迁移到更灵活配置模型的更多信息,请参阅此文档。

内容处置 content-disposition

对于发布层,提供 blob 时默认采用附件形式。 使用 Dispatcher 中的标准内容处置标头对其进行覆盖。

以下是配置外观的示例:

<LocationMatch "^\/content\/dam.*\.(pdf).*">
 Header unset Content-Disposition
 Header set Content-Disposition inline
</LocationMatch>

支持的 Apache 模块 supported-directives

下表显示了支持的 Apache 模块:

模块名称
引用页面
core
https://httpd.apache.org/docs/2.4/mod/core.html
mod_access_compat
https://httpd.apache.org/docs/2.4/mod/mod_access_compat.html
mod_alias
https://httpd.apache.org/docs/2.4/mod/mod_alias.html
mod_allowmethods
https://httpd.apache.org/docs/2.4/mod/mod_allowmethods.html
mod_authn_core
https://httpd.apache.org/docs/2.4/mod/mod_authn_core.html
mod_authn_file
https://httpd.apache.org/docs/2.4/mod/core.html
mod_authz_core
https://httpd.apache.org/docs/2.4/mod/core.html
mod_authz_groupfile
https://httpd.apache.org/docs/2.4/mod/mod_authz_groupfile.html
mod_deflate
https://httpd.apache.org/docs/2.4/mod/mod_deflate.html
mod_dir
https://httpd.apache.org/docs/2.4/mod/mod_dir.html
mod_env
https://httpd.apache.org/docs/2.4/mod/mod_env.html
mod_filter
https://httpd.apache.org/docs/2.4/mod/mod_filter.html
mod_headers
https://httpd.apache.org/docs/2.4/mod/mod_headers.html
mod_mime
https://httpd.apache.org/docs/2.4/mod/mod_mime.html
mod_proxy
https://httpd.apache.org/docs/2.4/mod/mod_proxy.html
mod_proxy_http
https://httpd.apache.org/docs/2.4/mod/mod_proxy_http.html
mod_remoteip
https://httpd.apache.org/docs/2.4/mod/mod_remoteip.html
mod_reqtimeout
https://httpd.apache.org/docs/2.4/mod/mod_reqtimeout.html
mod_rewrite
https://httpd.apache.org/docs/2.4/mod/mod_rewrite.html
mod_security
https://modsecurity.org/
mod_setenvif
https://httpd.apache.org/docs/2.4/mod/mod_setenvif.html
mod_ssl (only the SSLProxyEngine directive)
https://httpd.apache.org/docs/2.4/mod/mod_ssl.html#sslproxyengine
mod_substitute
https://httpd.apache.org/docs/2.4/mod/mod_substitute.html
mod_userdir
https://httpd.apache.org/docs/2.4/mod/mod_userdir.html
mod_macro
https://httpd.apache.org/docs/2.4/mod/mod_macro.html
mod_include (no directives supported)
https://httpd.apache.org/docs/2.4/mod/mod_include.html

客户无法添加任意模块,但会考虑在未来添加其他模块。 客户可以通过在SDK中运行验证器的命令来查找适用于给定Dispatcher版本的指令列表。

可以通过运行验证器的白名单命令来列出 Apache 配置文件中允许的指令:

$ validator allowlist
Cloud manager validator 2.0.4

Allowlisted directives:
  <Directory>
  ...

文件夹结构 folder-structure

项目的Apache和Dispatcher文件夹结构因项目使用的模式而略有不同,如上面使用Dispatcher工具进行验证和调试部分中所述。

部署Dispatcher配置 deploy-dispatcher-configurations

Cloud Manager通过全栈栈管道或Web层配置管道来部署您的Dispatcher配置。 Web层配置管道仅部署Dispatcher配置。

配置Web层配置管道时,将​ 代码位置 ​设置为包含conf.d、conf.dispatcher.d和opt-in目录的文件夹。 对于从结构未修改的AEM项目原型生成的项目,此文件夹为/dispatcher/src。

IMPORTANT
如果​ 代码位置 ​为/,并且您的Dispatcher配置位于子文件夹中,则管道找不到opt-in/USE_SOURCES_DIRECTLY文件并失败。

有关配置这些管道的步骤,请参阅添加生产管道和添加非生产管道。 有关Web层配置管道的详细信息,请参阅CI/CD管道。

从 AMS 迁移 Dispatcher 配置 ams-aem

有关如何将 Dispatcher 配置从 AMS 迁移到 AEM as a Cloud Service 的详细信息,请参阅将 Dispatcher 配置从 AMS 迁移到 AEM as a Cloud Service 页面。

recommendation-more-help
experience-manager-cloud-service-help-main-toc