mardi 24 février 2015

Jetty's (7.3.1) Rewrite

As I don't have the source of a Web application, I created another one that would do the necessary verfications before allowing any request to reach the main app.


And since I am using Jetty, I made use of Rewrite.


I successfully intercept HTTP requests intended to reach the app to be protected. But when the new app redirects to the subject app, I somehow end up in an infinite loop.


Consequently, Jetty blocks the redirection to the url that matches the filter value in the Jetty-Rewrite.xml file.


All that works so far is to be redirected to the verifications forms. I can't move forward.


The two crucial rules in Jetty-Rewrite.xml, and cause the problem, look like the following:





<Call name="addRule">
<Arg>
<New class="org.eclipse.jetty.rewrite.handler.RewriteRegexRule">
<Set name="regex">/destination-app/(.*)</Set>
<Set name="replacement">/verification-app/</Set>
<Set name="terminating">false</Set>
</New>
</Arg>
</Call>
<Call name="addRule">
<Arg>
<New class="org.eclipse.jetty.rewrite.handler.RewriteRegexRule">
<Set name="regex">/dummy-path/</Set>
<Set name="replacement">/destination-app/login.jsp</Set>
<Set name="terminating">false</Set>
</New>
</Arg>
</Call>



Basically, that's what I need to do:


enter image description here





Aucun commentaire:

Enregistrer un commentaire