Hi everyone,
I'm struggling with migration from Resin Pro 3.1.10 to Resin Pro 4.0.41 in
context of URL Rewriting at the *HOST* Level.
Problem in a nutshell:
- In 3.1 it was possible to change HOST level rewrite rules that are
configured in an external file without an automatic host restart -> no
interruptions for web-apps.
- In 4.0.41 I am not able to achieve this with the 4.0 syntax. Changing a
rewrite rule in the external file will enforce a restart of the host by Resin
-> all web-apps are restarted.
Let me explain it more detailed:
In 3.1 I've been configuring URL rewrite rules in an external file named
"misc-and-adhoc-host-level-rewrite.conf" => see below extracts from my
configuration.
Whenever I'm changing the external configuration file
"misc-and-adhoc-host-level-rewrite.conf", then Resin 3.1 applies the changes
and just logs the <resin:message> information
ð But the really good thing is that all defined web-apps in Host will remain
up and running without any interruptions.
Resin 3.1:
-- -- -- -- resin-3.1.conf extract -- -- -- --
<!-- Primary Host with all webapps -->
<host host-name="www.example.com">
<!-- creates the webapps directory for .war expansion -->
<web-app-deploy path="webapps"/>
<rewrite-dispatch>
<!-- Ad Hoc Rewrite Rules such as forbidden ip address or miscellaneous
(external) -->
<import
path='${resin.root}/conf/rewrite/misc-and-adhoc-host-level-rewrite.conf'
name="MiscAdHocHostLevelImportRewrite"/>
<!-- And some other Host-Level Rewrite Rules -->
</rewrite-dispatch>
<!-- ROOT / Homepage -->
<web-app id="/" root-directory="/home/stbu/homepage/live">
<resin:import
path="${resin.root}/conf/web-app-ext-conf/root_homepage.conf"/>
</web-app>
<!-- many, many other web-apps -->
</host>
-- -- -- -- resin-3.1.conf extract -- -- -- --
-- -- -- -- misc-and-adhoc-host-level-rewrite.conf extract -- -- -- --
<rewrite-dispatch xmlns="http://caucho.com/ns/resin"
xmlns:resin="http://caucho.com/ns/resin/core">
<resin:message>External rewrite configuration read from '${__FILE__}'
...</resin:message>
<moved-permanently regexp="^/en/faq(/?)$"
target="/en/frequently-asked-questions.jsp"/>
</rewrite-dispatch>
-- -- -- -- misc-and-adhoc-host-level-rewrite.conf extract -- -- -- --
I know that <rewrite-dispatch> and at least <moved-permanently> (don't know yet
about the other tags) are working in my resin-pro-4.0.41 because of
backward-compat but I can't figure out how to achieve this with the new
Resin-4.0 Syntax.
I tried three things:
1.) Just change <moved-permanently> to <resin:MovedPermanently>, but this will
not work:
test-rewrite-4.xml:7: 'resin:MovedPermanently' is an unknown property of
'com.caucho.server.rewrite.MatchRule'.
2.) Additionally changed the XMLNS in the external file from
<rewrite-dispatch xmlns="http://caucho.com/ns/resin"
xmlns:resin="http://caucho.com/ns/resin/core">
into
<rewrite-dispatch xmlns="http://caucho.com/ns/resin"
xmlns:resin="urn:java:com.caucho.resin">
Still the same Error:
test-rewrite-4.xml:7: 'resin:MovedPermanently' is an unknown property of
'com.caucho.server.rewrite.MatchRule'.
3.) As I can't find a "container-tag" in 4.0 Syntax like <rewrite-dispatch>
where <resin:MovedPermanently> can be configured, I had to change my external
config file from <rewrite-dispatch> to the <host> tag.
-- -- -- -- resin-4.0.xml extract -- -- -- --
<!-- Primary Host with all webapps -->
<host host-name="www.example.com">
...
<!-- creates the webapps directory for .war expansion -->
<web-app-deploy path="webapps"/>
<!-- Ad Hoc Rewrite Rules such as forbidden ip address or miscellaneous
(external) -->
<resin:import path='${resin.root}/conf/rewrite/test-rewrite-4.xml'/>
<!-- ROOT / Homepage -->
<web-app id="/" root-directory="/home/stbu/homepage/live">
<resin:import
path="${resin.root}/conf/web-app-ext-conf/root_homepage.conf"/>
</web-app>
<!-- many, many other web-apps -->
</host>
-- -- -- -- resin-3.1.conf extract -- -- -- --
and the external file now looks like this:
-- -- -- -- test-rewrite-4.xml -- -- -- --
<host xmlns="http://caucho.com/ns/resin"
xmlns:resin="urn:java:com.caucho.resin">
<resin:message>External rewrite configuration read from '${__FILE__}'
...</resin:message>
<resin:MovedPermanently regexp="^/en/faq(/?)$"
target="/en/frequently-asked-questions.jsp"/>
</host>
-- -- -- -- test-rewrite-4.xml -- -- -- --
But now when I change the external file (for example to change one of the
targets), the HostController detects the change and the whole Host as well as
all the web-apps are stopped, restarted and Users are interrupted.
[14-10-15 12:50:42.933] {resin-port-8444-26} INFO
com.caucho.server.host.HostController
/home/stbu/websrv/websrv-resin-4/conf/rewrite/test-rewrite-4.xml length is
modified (309 -> 313)
[14-10-15 12:50:42.934] {resin-port-8444-26} INFO com.caucho.server.host.Host
Host[production/host/localhost] stopping
ð Any chance to use the new 4.0 Syntax and rewrite capabilities on Host Level
without the negative side effect of a Host restart?
Thanks and kind regards,
Steffen
_______________________________________________
resin-interest mailing list
[email protected]
http://maillist.caucho.com/mailman/listinfo/resin-interest