服务器修改的配置怎么撤回,第 4 章 服务器配置的修改

4.4.2. 迁移 JBoss Web 重写条件

管理 CLI 的 migrate 操作无法自动迁移重写条件,它们被报告为“migration-warnings”,您必须手动迁移它们。在 JBoss EAP 7 里,您可以用 Undertow Predicates Attributes and Handlers 创建同等的配置。

下面是 JBoss EAP 6 里包含 rewrite 配置的默认 web 子系统配置示例。

按照 Management CLI Migration Operation 说明启动服务器和管理 CLI,然后用下列命令迁移 web 子系统配置文件。/subsystem=web:migrate

当您对上述配置运行 migrate 操作时会出现下面的 "migration-warnings" 信息。/subsystem=web:migrate

{

"outcome" => "success",

"result" => {"migration-warnings" => [

"WFLYWEB0002: Could not migrate resource {

\"pattern\" => \"(.*)\",

\"substitution\" => \"-\",

\"flags\" => \"F\",

\"operation\" => \"add\",

\"address\" => [

(\"subsystem\" => \"web\"),

(\"virtual-server\" => \"default-host\"),

(\"rewrite\" => \"test2\")

]

}",

"WFLYWEB0002: Could not migrate resource {

\"test\" => \"%{REQUEST_METHOD}\",

\"pattern\" => \"GET\",

\"flags\" => undefined,

\"operation\" => \"add\",

\"address\" => [

(\"subsystem\" => \"web\"),

(\"virtual-server\" => \"default-host\"),

(\"rewrite\" => \"test2\"),

(\"condition\" => \"get\")

]

}",

"WFLYWEB0002: Could not migrate resource {

\"test\" => \"%{REQUEST_URI}\",

\"pattern\" => \".*index.html\",

\"flags\" => \"NC\",

\"operation\" => \"add\",

\"address\" => [

(\"subsystem\" => \"web\"),

(\"virtual-server\" => \"default-host\"),

(\"rewrite\" => \"test2\"),

(\"condition\" => \"andCond\")

]

}"

]}

}

复查服务器配置文件,您会看到 undertow 子系统的下列配置。

注意

重写(Rewrite)配置已被舍弃。

使用管理 CLI 创建过滤器来替换 undertow 子系统里的重写配置。每个命令您都应该看到 "{"outcome" ⇒ "success"}" 信息。# Create the filters

/subsystem=undertow/configuration=filter/expression-filter="test1":add(expression="path('(.*)/toberewritten/(.*)') -> rewrite('$1/rewritten/$2')")

/subsystem=undertow/configuration=filter/expression-filter="test2":add(expression="method('GET') and path('.*index.html') -> response-code(403)")

# Add the filters to the default server

/subsystem=undertow/server=default-server/host=default-host/filter-ref="test1":add

/subsystem=undertow/server=default-server/host=default-host/filter-ref="test2":add

复查已更新的服务器配置文件。JBoss Web 子系统现在已完全迁移且已配置了 undertow 子系统。

关于如何用管理 CLI 配置过滤器和处理程序的更多信息,请参考《JBoss EAP 7 配置指南》 里的 Configuring the Web Server。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值