source: installer/resources/eepsite/jetty-rewrite.xml @ e7c2162

Last change on this file since e7c2162 was 6b4f665, checked in by zzz <zzz@…>, 4 years ago

Add more markers and protection for xml file migration
Add error message for jetty-jmx.xml migration, don't migrate
Update non-default files jetty-rewrite.xml and jetty-jmx.xml

  • Property mode set to 100644
File size: 3.9 KB
Line 
1<?xml version="1.0"?>
2<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
3
4<!-- =============================================================== -->
5<!-- Mixin the RewriteHandler                                        -->
6<!-- =============================================================== -->
7
8
9<Configure id="Server" class="org.eclipse.jetty.server.Server">
10
11    <!-- =========================================================== -->
12    <!-- configure rewrite handler                                   -->
13    <!-- =========================================================== -->
14    <Get id="oldhandler" name="handler"/>
15
16    <Set name="handler">
17     <New id="Rewrite" class="org.eclipse.jetty.rewrite.handler.RewriteHandler">
18      <Set name="handler"><Ref refid="oldhandler"/></Set>
19      <Set name="rewriteRequestURI">true</Set>
20      <Set name="rewritePathInfo">false</Set>
21      <Set name="originalPathAttribute">requestedPath</Set>
22
23      <!-- Add rule to protect against IE ssl bug -->
24      <Call name="addRule">
25        <Arg>
26          <New class="org.eclipse.jetty.rewrite.handler.MsieSslRule"/>
27        </Arg>
28      </Call>
29
30      <!-- protect favicon handling -->
31      <Call name="addRule">
32        <Arg>
33          <New class="org.eclipse.jetty.rewrite.handler.HeaderPatternRule">
34            <Set name="pattern">/favicon.ico</Set>
35            <Set name="name">Cache-Control</Set>
36            <Set name="value">Max-Age=3600,public</Set>
37            <Set name="terminating">true</Set>
38          </New>
39        </Arg>
40      </Call>
41
42      <!-- redirect from the welcome page to a specific page -->
43      <Call name="addRule">
44        <Arg>
45          <New class="org.eclipse.jetty.rewrite.handler.RewritePatternRule">
46            <Set name="pattern">/rewrite/</Set>
47            <Set name="replacement">/rewrite/info.html</Set>
48          </New>
49        </Arg>
50      </Call>
51
52      <!-- replace the entire request URI -->
53      <Call name="addRule">
54        <Arg>
55          <New class="org.eclipse.jetty.rewrite.handler.RewritePatternRule">
56            <Set name="pattern">/some/old/context</Set>
57            <Set name="replacement">/rewritten/newcontext</Set>
58          </New>
59        </Arg>
60      </Call>
61
62      <!-- replace the beginning of the request URI -->
63      <Call name="addRule">
64        <Arg>
65          <New class="org.eclipse.jetty.rewrite.handler.RewritePatternRule">
66            <Set name="pattern">/rewrite/for/*</Set>
67            <Set name="replacement">/rewritten/</Set>
68          </New>
69        </Arg>
70      </Call>
71
72      <!-- reverse the order of the path sections -->
73      <Call name="addRule">
74        <Arg>
75          <New class="org.eclipse.jetty.rewrite.handler.RewriteRegexRule">
76            <Set name="regex">(.*?)/reverse/([^/]*)/(.*)</Set>
77            <Set name="replacement">$1/reverse/$3/$2</Set>
78          </New>
79        </Arg>
80      </Call>
81
82      <!-- add a cookie to each path visited -->
83      <Call name="addRule">
84        <Arg>
85          <New class="org.eclipse.jetty.rewrite.handler.CookiePatternRule">
86            <Set name="pattern">/*</Set>
87            <Set name="name">visited</Set>
88            <Set name="value">yes</Set>
89          </New>
90        </Arg>
91      </Call>
92
93      <!--  actual redirect, instead of internal rewrite -->
94      <Call name="addRule">
95        <Arg>
96          <New class="org.eclipse.jetty.rewrite.handler.RedirectPatternRule">
97            <Set name="pattern">/redirect/*</Set>
98            <Set name="location">/redirected</Set>
99          </New>
100        </Arg>
101      </Call>
102
103      <!-- add a response rule -->
104      <Call name="addRule">
105        <Arg>
106           <New class="org.eclipse.jetty.rewrite.handler.ResponsePatternRule">
107             <Set name="pattern">/400Error</Set>
108             <Set name="code">400</Set>
109             <Set name="reason">ResponsePatternRule Demo</Set>
110          </New>
111        </Arg>
112      </Call>
113
114     </New>
115    </Set>
116
117</Configure>
Note: See TracBrowser for help on using the repository browser.